Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- int main() {
- int guNum;
- std::string question;
- srand(time(0));
- std::cout << "Guessing Game! Try guessing the Number, from 1-9\n\n";
- do{
- for (int count = 1; count < 10; count++) {
- int ranNum = 1 + (rand() % 9);
- std::cout << "Guess the Number now! ";
- std::cin >> guNum;
- if (guNum == ranNum) {
- std::cout << "Yes! Thats right!!!\n\n";
- }
- else {
- std::cout << "Thats wrong! The Number was " << ranNum << "." << std::endl << std::endl;
- }
- }
- std::cout << "do you want to do it again?\n";
- std::cin >> question;
- } while (question == "yes");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement