#include <iostream>
using namespace std;
void menu(void);
int main() {
char ch;
menu();
A: cin.get(ch).get();
switch(ch)
{
case 'c':cout<<"Tigger is a carnivore."<<endl;
break;
case 'p':cout<<"Di is a pianist."<<endl;
break;
case 't':cout<<"A maple is a tree."<<endl;
break;
case 'g':cout<<"He likes play games."<<endl;
break;
default :cout<<"Please enter a c,p,t,or g:";
goto A;
}
return 0;
}
void menu(void)
{
cout<<"Please enter one of the following choices:"<<endl;
cout<<"c) carnivore p) pianist"<<endl
<<"t) tree g) game"<<endl;
}```
C++ primer plus 6th 6.3答案
最新推荐文章于 2024-10-07 19:01:55 发布