Skip to content

Instantly share code, notes, and snippets.

@mshafae
Last active December 13, 2023 23:17
Show Gist options
  • Save mshafae/cfbbe37b090687dd8a57acfbf7706844 to your computer and use it in GitHub Desktop.
Save mshafae/cfbbe37b090687dd8a57acfbf7706844 to your computer and use it in GitHub Desktop.
CPSC 12120 Loop until a number is entered that matches the criteria.
// Gist https://gist.github.com/cfbbe37b090687dd8a57acfbf7706844
#include <iostream>
int main(int argc, char const *argv[]) {
int input_number{0};
do {
std::cout << "Enter a number between 10 and 20: ";
std::cin >> input_number;
} while (input_number < 10 || input_number > 20);
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