Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- int num{ 0 };
- bool incorrectNumber{ false };
- do
- {
- std::cout << "Enter some numer 0-999\n";
- std::cin >> num;
- //flag = !(num >= 0 and num <= 999);
- incorrectNumber = num < 0 or num > 999;
- if (incorrectNumber)
- {
- std::cout << "Incorrect number!\Try again!\n";
- }
- } while (incorrectNumber);
- std::cout << "Good number is: " << num << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement