Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- int main()
- {
- int hun;
- std::string answer;
- bool repeat = true;
- while (repeat == true)
- {
- std::cout << "Please pick a number between 1 and 100 \n";
- std::cin >> hun;
- if (hun > 50 && hun <= 100)
- {
- std::cout << "Your number is greater than 50. ";
- }
- else if (hun < 50)
- {
- std::cout << "Your number is less than 50. ";
- }
- else if (hun == 50)
- {
- std::cout << "Your number is equal to 50. ";
- }
- else
- {
- std::cout << "Pick a number less than 100. ";
- }
- std::cout << "Want to try again? ";
- std::cin >> answer;
- if (answer == "Yes" || answer == "yes")
- {
- repeat = true;
- }
- else if (answer == "No" || answer == "no")
- {
- repeat = false;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment