I am fairly new to C++, as I am currently up to and studying switch statements for this language tool. I am having problems with my code for I lack the understanding required for making relevant configurations that would help solve possible outputting problem. This problem resolves around the problem outputting the default switch choice, as opposed to the desirable case when entering the relevant input character:
#include <iostream>
using namespace std;
int main()
{
char Poke;
cout << "Please select your starter Pokemon:" << endl;
cin >> Poke;
switch (Poke) {
case 'Bulbasaur':
cout << "You have selected " << Poke << endl;
break;
case 'Charmander':
cout << "You have selected " << Poke << endl;
break;
case 'Squirtle':
cout << "You have selected" << Poke << endl;
break;
default:
cout << "Entry Unknown" << endl;
break;
}
}
Yes this code is based on the original three starter Pokemon from Gen One. Whenever I select, choose and input 'Charmander' onto the command prompt window box, it would not read my input for some reason and would only output the default which would be "Entry Unknown":
Sorry I couldn't embedded image. Don't have enough reputation points :/