话不多说直接上代码!
#include <iostream>
using namespace std;
int main() {
char choice;
cout << "please enter one of the following choices:\n"
<< "c) carnivore p)pianist\n" << "t) tree g) game\n";
par:
cin >> choice;
switch (choice) {
case 'c':cout << "A maple is a carnivore.";
break;
case 'p':cout << "A maple is a pianist.";
break;
case 't':cout << "A maple is a tree.";
break;
case 'g':cout << "A maple is a game.";
break;
default:cout << "please enter a c, p, t, or g:";
goto par;
}
return 0;
}