|
该程序整体修改如下:
程序代码:
#include <iostream>
using namespace std;
void main()
{
char* Month[]={"January","February","March","April","May","June","July","August",\
"September","October","November","December"};
int n;
int count=0;
do
{
cout <<"请输入要查询的月份:";
cin>>n;
if(n>12 || n<1)
cout <<"月份有小于1或大约12的吗?\n\n";
else break;
count++;
}while(count<3);
if(count==3)
{
cout <<"输入3次错误\n";
exit(1);
}
else cout<<Month[n-1]<<endl;
} |
|