分类: C/C++
2007-07-02 20:50:57
#include
void main()
{
int choice=0;
do {
cout <<"功能选择表\n";
cout <<"(1)打开新文件.\n";
cout <<"(2)增加数据.\n";
cout <<"(3)删除数据.\n";
cout <<"(4)查找数据.\n";
cout <<"(5)结束程序.\n";
cout <<"请输入数字(1~5):";
cin >>choice;
if (choice<1||choice>5)
{
cout <<"输入错误!请再输入一次...\n";
continue;
}
switch (choice)
{
case 1:cout <<"您选择了打开新文件功能!\n";
break;
case 2:cout <<"您选择了增加数据功能!\n";
break;
case 3:cout <<"您选择了删除数据功能!\n";
break;
case 4:cout <<"您选择了查找数据功能!\n";
break;
case 5:cout <<"您选择了结束程序功能!\n";
break;
}
}while (choice!=5);
cout <<"程序结束!";
}