#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include<array>
#include<cctype>
using namespace std;
int main()
{
char ch;
cout << "Please enter one of the following choices:\n";
cout << "c) carnivore\t\tp) painist\nt) tree\t\t\tg) game\n";
ch=cin.get();
while ((ch != 'c') &&(ch != 'p') && (ch != 't') && (ch != 'g'))
{
cout << "Please enter a c,p,t, or g: ";
while (cin.get() != '\n')
continue;
ch = cin.get();
}
switch (ch)
{
case'c':cout << "A tiger is a carnivore.\n"; break;
case'p':cout << "Langlang is a great pianist.\n"; break;
case't':cout << "A maple is a tree.\n"; break;
case'g':cout << "Narotu--the ninja storm 4 will public in 2015.\n"; break;
default:
break;
}
return 0;
}
C++ primer plus第六版课后编程练习答案:6.3
最新推荐文章于 2023-09-23 00:29:05 发布