Advertisement
Felanpro

Basic Loops

Nov 3rd, 2015
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     /*BASIC LOOPS (VERY IMPORTANT TO HAVE THIS KNOWLEDGE IF YOU WANT TO BECOME A PROGRAMMER*/
  9.    
  10.     /*While Loop
  11.     int i = 0;
  12.    
  13.     while(i < 100)
  14.     {
  15.             cout << "i is " << i << endl;
  16.             i++;
  17.             }
  18.             */
  19.            
  20.     /*For Loop
  21.     for(int i = 0; i < 100; i++)
  22.     {
  23.             cout << "i is " << i << endl;
  24.             }
  25.             */
  26.            
  27.     /*Do While Loop
  28.     int radius = -1;
  29.            
  30.     do
  31.     {
  32.            cout << "Enter a radius" << endl;
  33.            cin >> radius;
  34.            }while(radius <= 0);
  35.            */
  36.            
  37.    
  38.                
  39.          return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement