I am trying to create a guessing game where if the player guesses one of many correct strings he will win. Although the switch statement will work with a single letter in the switch parenthesis but it wont work if i put my string in it.
#include "stdafx.h"
#include < iostream>
using namespace std;
class Player
{
public:
void Guess();
};
void Guess()
{
char guess;
char* word1 = "Dog";
char* word2 = "Cat";
cout <<"Welcome to guess the word. Get ready..." <<endl;
cout <<"Guess the word: " <<endl;
cin >>guess;
for (int i = 0; i <= 3; i++) //give the player 3 trys at guessing
{
switch(guess)
{
case 'Dog':
cout <<"Dog is correct." <<endl;
i = 3;
break;
default:
cout <<guess <<" is incorrect." <<endl;
cin >>guess;
}
}
}
int main()
{
Guess();
char f;
cin >>f;
return 0;
}