Using goto : goto « Operators statements « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

#include <iomanip>
using std::left;
using std::setw;

int main()
{
   int count = 1;

   start:
      if ( count > 5 )
         goto end;

      cout << count << "\n\n";
      ++count;

      goto start;             

   end:
      cout << endl;

   return 0;
}
1

2

3

4

5








3.20.goto
3.20.1.Using goto
3.20.2.goto loop example