Advertisement
DrDiagramm

Untitled

Feb 9th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <string>
  5.  
  6. int main() {
  7. int guNum;
  8. std::string question;
  9. srand(time(0));
  10.  
  11. std::cout << "Guessing Game! Try guessing the Number, from 1-9\n\n";
  12.  
  13. do{
  14. for (int count = 1; count < 10; count++) {
  15. int ranNum = 1 + (rand() % 9);
  16. std::cout << "Guess the Number now! ";
  17. std::cin >> guNum;
  18. if (guNum == ranNum) {
  19. std::cout << "Yes! Thats right!!!\n\n";
  20.  
  21. }
  22. else {
  23. std::cout << "Thats wrong! The Number was " << ranNum << "." << std::endl << std::endl;
  24. }
  25. }
  26. std::cout << "do you want to do it again?\n";
  27. std::cin >> question;
  28. } while (question == "yes");
  29. system("pause");
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement