Your goal for this assignment is to create a playable Wheel
Your goal for this assignment is to create a playable Wheel of Fortune (Hangman) game in C++. You will need to create a secret word for the user to try and guess one letter at a time.
First you need to ask the user to enter a letter. Then you\'ll check if that letter exists in your secret word. If it does exist, then you should tell the user and display the puzzle with the letter revealed. If the letter does not exist, then inform user the letter is not found. You will repeat this process until all the correct letters have been guessed or the user has entered 7 wrong letters.
An example of a winning game:
Wheel! Of!! Fortune!!!
Take a guess: _ _ _ _ _ _ _ _ _ _ _
Your guess: a
There\'s an A!
Take a guess: _ _ _ _ _ A _ _ _ _ _
Your guess: c
Sorry, no C\'s. You have 6 wrong guesses remaining.
Take a guess: _ _ _ _ _ A _ _ _ _ _
Your guess: a
You already guessed A.
...
Take a guess: P R O _ R A M M I N _
Your guess: g
CONGRATS! You solved the puzzle: P R O G R A M M I N G
Solution
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
string Str=\"PROGRAMMING\";
char letter;
cout<<\"Enter guess letter: \";
cin>>letter;
for (int i = 0; i < Str.length()-1; i++)
{
if (Str.at(i) == letter)
{
cout << \"The letter \" << letter << \" is in the given string.\" << endl;
}
else{
cout << \"You have chosen poorly.\" << endl;}
}
return 0;
}
