C++ examples for Statement:do while
A loop can test the condition at the end of the loop with the do-while statement.
#include <iostream> int main() /*from ww w . j a v a 2 s.c o m*/ { int badger; std::cout << "How many badgers? "; std::cin >> badger; do { std::cout << "Badger "; badger--; } while (badger > 0); std::cout << "\n"; return 0; }