Created
March 18, 2014 02:36
-
-
Save NeilHanlon/9612571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main(){ | |
int i = 10; | |
string yn; | |
cout << "Print numbers 10 through 100:\n\n"; | |
while(i <= 100){ | |
cout << i << " "; | |
++i; | |
if(!(i % 10)){ | |
cout << endl; | |
} | |
} | |
cout << "\n\nEnter 'yes' to stop execution:\n\n"; | |
do{ | |
cout << "\nLoops in C++ are easy.\nInput:"; | |
cin >> yn; | |
} while(string(yn) != string("yes")); | |
cout << endl << "\n\nPrint even numbers, 10-100:\n\n"; | |
i = 10; | |
while(i <= 100){ | |
cout << i << " "; | |
i += 2; | |
if(!(i % 10)){ | |
cout << "\n"; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment