0
[c++] Give me some example with Do...While
Hey guys, I don't understand yet how works do and while loops. Can you do me some example? I mean something other then "number 1, number2, number3"
2 ответов
+ 5
int i = 0;
do {
std::cout << "Printed: " << i << std::endl;
i++;
} while (i <= 10);
// Prints "Printed: <iter>" ten times while int i <= 10.
+ 2
cout << "Please enter a number between 1 and 10!";
int number{};
do {
cin >> number;
} while (number<1||number>10);