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

#include <iostream>
using namespace std;
void showmenu(void)
{
	cout<<"Please enter one of the following choices:
"
		"c) carnivore         p) pianist
"
		"t) tree              g) game
";
}
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;
}
原文地址:https://www.cnblogs.com/lynnycy/p/3452080.html