/* testrep3.cpp CIS 150 6/7/2005 David Klick Demonstration of do/while loop. */ #include using std::cout; int main(void) { int ctr; // first count up by 1 ctr = 1; do { cout << ctr << " "; ctr++; } while (ctr<=10); cout << '\n'; // then count down by 1 ctr = 10; do { cout << ctr << " "; ctr--; } while (ctr>=1); return 0; } /* Sample output: 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1 */