Monday 27 August 2012

Lecture 138


                                                Lecture 138
// Loop GoTo
#include <iostream>
#include <conio.h>
using namespace std;
 main ()
{  
      int count,total;
      count=0,total=0;
      Loop1: //Label
         total=total+count;
         cout<<"Count: "<<count<<"  Total: "<<total<<endl;        
         count++;
         if(count==10) 
             goto Loop2;
         goto Loop1;
   Loop2:        
  getch();
  return 0;
}

Output: