#include = { “america”,”england”,”holland”,”pakistan”, “india”, “nepal”, “japan”, “china”, “madagascar”,

#include #include #include #include #include using namespace std;const int MAX_TRIES = 5;void introduction();void countries(string);int letterFill(char, string, string&, string);bool check(char arr, char c);void displayUsed(char);void displayLogo();void displayLoss();void displayWin();int main(){ char input; string name; char letter; int wrongGuesses = 0; string word; string words = { “america”,”england”,”holland”,”pakistan”, “india”, “nepal”, “japan”, “china”, “madagascar”, “azerbaijan”, “kyrgyzstan”, }; a: displayLogo(); cout << " Press 1 for Introduction "; cout << " Press 2 for paly "; cout << " Press 3 for countries "; cout << " Press 4 for Exit "; cout << "Press:"; cin >> input; if (input<49 || input>52) { cout << "wrong input" << endl; system("Pause"); system("CLS"); goto a; } if (input == '1') { introduction(); system("Pause"); system("CLS"); goto a; } b: if (input == '2') { system("cls"); //choose and copy a word from array of words randomly srand(time(NULL)); int n = rand() % 11; word = wordsn; // Initialize the secret word with the * character. string unknown(word.length(),'*'); string res(word.length(),'*'); for (int i = 0; i < 3; i++) { //srand(time(NULL)); int r = rand() % (word.length()-1); unknownr = wordr; } res = unknown; char alpha20 = {NULL}; int j = 0; // Loop until the guesses are used up while (wrongGuesses < MAX_TRIES) { cout << " " << unknown; cout << " Guess:"; cin >> letter; system(“cls”); // displayUsed(alpha); if (check(alpha, letter)) { alphaj = letter; j++; } // Fill secret word with letter if the guess is correct, // otherwise increment the number of wrong guesses. if (letterFill(letter, word, unknown, res) == 0) { cout << endl << "Whoops! That letter isn't in there!" << endl; wrongGuesses++; cout << "Guessed Letters: "; displayUsed(alpha); cout << endl; } else { cout << endl << "You found a letter! Isn't that exciting?" << endl; cout << "Guessed Letters: "; displayUsed(alpha); cout << endl; } // Tell user how many guesses has left. cout << "You have " << MAX_TRIES - wrongGuesses; cout << " guesses left." << endl; // Check if user guessed the word. if (word == unknown) { cout << word << endl; cout << "Yeah! You got it! "; displayWin(); system("PAUSE"); unknown.clear(); word.clear(); wrongGuesses= 0; goto b; } } if (wrongGuesses == MAX_TRIES) { cout << " Sorry, you lose...you've been hanged." << endl; displayLoss(); unknown.clear(); word.clear(); wrongGuesses = 0; system("Pause"); system("CLS"); goto a; } } if (input == '3') { system("CLS"); countries(words); system("Pause"); system("CLS"); goto a; } if (input == '4') { return 0; } } void introduction(){ // welcome the user system("cls"); displayLogo(); cout << "- Each letter is represented by an asterisk. "; cout << "- You have to type only one letter in one try. "; cout << "- You have " << MAX_TRIES << " tries to try and guess the country. "; cout << "Developed by: "; cout << "-Arbaz Arif "; cout << "-Hammad Shahid "; cout << "-Saad Sohail "; cout << "-Osama Khalil "; cout << "Instructor: "; cout << "-Sir Bilal Rasheed Arain ";} void countries(string con){ cout<<" Countries"<