Hi, C++ noob here. I'm trying to have it so that my program reads numeric values from variables declared earlier in the code (which were calculated from user input) and outputs those numeric values as text at the end. Basically this secret code decoder thing. However, I'm ripping my hair out trying to get it displayed properly.
I want to use a "switch" statement that sets my string variable to a certain text depending on the number calculated earlier. I also want it so it outputs it at the very end so the text is displayed with the string values displayed. Here's a modified bit of my code:
Code:
int RendPoint;
string RendPointC = "";
cin >> RendPoint;
switch(RendPoint)
{
case '2':
RendPointC = RendPointC + "fountain ";
break;
case '7':
RendPointC = RendPointC + "large tree ";
break;
case '8':
RendPointC = RendPointC + "church ";
break;
default:
cout << "Error!!! ";
}
cout << RendPointC << endl;
When I try entering in 2, 7, or 8 I only get the default statement. Please help