Skip to content

Instantly share code, notes, and snippets.

@NeilHanlon
Created March 18, 2014 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeilHanlon/9612571 to your computer and use it in GitHub Desktop.
Save NeilHanlon/9612571 to your computer and use it in GitHub Desktop.
#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