#include<iostream>
#include<cmath>
using namespace std;
void k()
{
int x,y;
cout<<"input 2 nums:"<<endl;
cin>>x>>y;
cout<<"Do you want to?";
char p;
cin>>p;
switch(p)
{
case '+':cout<<"x"<<"+"<<"Y"<<"="<<x+y;
break;
case '-':cout<<"x"<<"-"<<"Y"<<"="<<x-y;
break;
case '/':
if(y==0)
cout<<"wrong,num overflow!!!";
else
cout<<"x"<<"/"<<"Y"<<"="<<x/y;
break;
case '*':cout<<"x"<<"*"<<"Y"<<"="<<x*y;
break;
}
}
void main()
{
int flag=1;
char pp;
while(flag)
{
k();
}
cout<<"Continue?(y/n)";
cin>>pp;
if(pp=='n')
flag=0;
else
k();
}
在运行完第一次后,直接就进入了,怎么能修改一下程序,从键盘接受'y'以后再input 2 num?