编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3

#include <iostream>
using namespace std;
void showmenu(void)
{
cout<<"Please enter one of the following choices:\n"
"c) carnivore p) pianist\n"
"t) tree g) game\n";
}
void ak(void)
{
cout<<"Please enter a c,p,t, or g:";
}
int main()
{
char input;
showmenu();
cin>>input;
while(input)
{
switch(input)
{
case 'c':cout<<"Ad is a carniore.";
break;
case 'p':
cout<<"Lynn is a pianist.";
break;
case 't':
cout<<"A maple is a tree.";
break;
case 'g':
cout<<" Swim is a game.";
break;
default:
ak();
}
//showmenu();
cin>>input;
}
system("pause");
return 0;
}
上一篇:编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2


下一篇:cdoj 1328 卿学姐与诡异村庄 Label:并查集 || 二分图染色