Advertisement
heimsventus

while loop and do loop

Jan 25th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. // ConsoleApplication3.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "stdafx.h"
  6. #include <iostream>
  7. #include <string>
  8. #include <cmath>
  9. using namespace std;
  10. int main()
  11. {
  12. int loopcounter = 0;
  13.  
  14.     while(loopcounter<100)
  15.     {
  16.         loopcounter++;
  17.         if (loopcounter % 5 == 0)
  18.             continue;
  19.         cout << "hello world forever" << loopcounter << endl;
  20.    
  21.     }
  22.    
  23.     do
  24.     {
  25.         loopcounter++;
  26.         if (loopcounter % 5 == 0)
  27.             continue;
  28.         cout << "hello world forever" << loopcounter << endl;
  29.  
  30.  
  31.  
  32.     } while (loopcounter <100);
  33.  
  34. system("pause");
  35.  
  36. return 0;
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement