Last active
October 4, 2022 03:38
-
-
Save mshafae/450b2211f29cc7cae4735833f96bdedb to your computer and use it in GitHub Desktop.
Loop until a number is entered that matches the criteria.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gist https://gist.github.com/450b2211f29cc7cae4735833f96bdedb | |
#include <iostream> | |
int main(int argc, char const *argv[]) { | |
std::cout << "Enter a number between 10 and 20: "; | |
int input_number{0}; | |
std::cin >> input_number; | |
while (input_number < 10 || input_number > 20) { | |
std::cout << "Enter a number between 10 and 20: "; | |
std::cin >> input_number; | |
} | |
std::cout << "Thank you!\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment