Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. `#include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. string animal = "fish";
  6. string guess;
  7. char choose = 'Y';
  8. int count = 0;
  9. int limit = 5;
  10. bool out_of_guesses = false;
  11.  
  12. cout << "I am thinking of an animal.n" << endl;
  13.  
  14. do{
  15. while(animal != guess && !out_of_guesses){
  16. if(count < limit){
  17. cout << "Can you guess what animal I am thinking of?: ";
  18. getline(cin, guess);
  19. count++;
  20. if(animal != guess){
  21. cout << "nHmm, nope. That's not the animal I'm
  22. thinking of." << endl;
  23. if(count > 2 && count <5){
  24. cout << "I'll give you a hint. It lives in
  25. water." << endl;
  26. }
  27. }
  28. }
  29. else{
  30. out_of_guesses = true;
  31. }
  32. }
  33. if(out_of_guesses){
  34. cout << "nI'm sorry, but you are out of guesses.n"
  35. << endl;
  36. }
  37. else{
  38. cout << "n*** Good job! You guessed the correct
  39. animal! ***n" << endl;
  40. cout << "tt><)))º> ❤ <º)))><tt" << endl;
  41. }
  42. cout << "nWould you like to try again?: ";
  43. cin >> choose;
  44. }while(choose == 'Y' || 'y');
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement