编程菜鸟的日记-初学尝试编程-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;
}

 

posted @ 2013-12-01 02:08  编程的爬行者  阅读(149)  评论(0编辑  收藏  举报