33,311
社区成员
发帖
与我相关
我的任务
分享
/* 帮你简化了一些 ~~ */
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char f;
int n;
do
{
cout<<"please input n:"<<endl;
cin>>n;
if(cin.fail())
{
cout<<"data error!please input the integer:"<<endl;
cin.clear();
cin.sync();
continue;
}
cout<<n<<endl;
cout<<"Whether to continue to run Y/N"<<endl;
cin>>f;
}
while(f == 'y' || f == 'Y');
cout<<"the system is over thank for using;"<<endl;
system( "Pause ");
return 0;
}