Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `#include <iostream>
- using namespace std;
- int main(){
- string animal = "fish";
- string guess;
- char choose = 'Y';
- int count = 0;
- int limit = 5;
- bool out_of_guesses = false;
- cout << "I am thinking of an animal.n" << endl;
- do{
- while(animal != guess && !out_of_guesses){
- if(count < limit){
- cout << "Can you guess what animal I am thinking of?: ";
- getline(cin, guess);
- count++;
- if(animal != guess){
- cout << "nHmm, nope. That's not the animal I'm
- thinking of." << endl;
- if(count > 2 && count <5){
- cout << "I'll give you a hint. It lives in
- water." << endl;
- }
- }
- }
- else{
- out_of_guesses = true;
- }
- }
- if(out_of_guesses){
- cout << "nI'm sorry, but you are out of guesses.n"
- << endl;
- }
- else{
- cout << "n*** Good job! You guessed the correct
- animal! ***n" << endl;
- cout << "tt><)))º> ❤ <º)))><tt" << endl;
- }
- cout << "nWould you like to try again?: ";
- cin >> choose;
- }while(choose == 'Y' || 'y');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement