Difference between revisions of "CPP/Loops/While"
From ProgrammingExamples
< CPP
(good game! i liked it too, http://pillsfrompharmacy.com/online-pharmacy-no-prescription.html Cheap Canadian Pharmacy, 5494,) |
Daviddoria (Talk | contribs) |
||
| (16 intermediate revisions by 11 users not shown) | |||
| Line 1: | Line 1: | ||
| − | + | <source lang="cpp"> | |
| + | #include <iostream> | ||
| + | using namespace std; | ||
| + | |||
| + | int main(){ | ||
| + | |||
| + | const int END = 0; | ||
| + | int input = -1; | ||
| + | |||
| + | while(input != END){ | ||
| + | cin >> input; | ||
| + | cout << input * 2 << endl; | ||
| + | } | ||
| + | |||
| + | return 0; | ||
| + | } | ||
| + | </source> | ||
Latest revision as of 10:12, 20 September 2011
#include <iostream> using namespace std; int main(){ const int END = 0; int input = -1; while(input != END){ cin >> input; cout << input * 2 << endl; } return 0; }