求大神指点,为什么用c++编的程序输出结果后直接就自动退出了?
#include<string>;#include<iostream>;usingnamespacestd;intmain(){intnuma;intnumb;cout<...
#include<string>;
#include<iostream>;
using namespace std;
int main()
{
int numa;
int numb;
cout<<"a = :"<<endl;
cin>>numa;
cin>>numb;
cout<<"he :"<<numa+numb<<endl;
cin.get();
return 0;
} 展开
#include<iostream>;
using namespace std;
int main()
{
int numa;
int numb;
cout<<"a = :"<<endl;
cin>>numa;
cin>>numb;
cout<<"he :"<<numa+numb<<endl;
cin.get();
return 0;
} 展开
展开全部
cin.get()会读取cin>>numb中输入时的回车符,读入回车就直接返回了。
试试这样行不行:
#include<string>;
#include<iostream>;
using namespace std;
int main()
{
int numa;
int numb;
cout<<"a = :"<<endl;
cin>>numa;
cin>>numb;
cout<<"he :"<<numa+numb<<endl;
cin>>numb;
return 0;
}
试试这样行不行:
#include<string>;
#include<iostream>;
using namespace std;
int main()
{
int numa;
int numb;
cout<<"a = :"<<endl;
cin>>numa;
cin>>numb;
cout<<"he :"<<numa+numb<<endl;
cin>>numb;
return 0;
}
追问
太谢谢啦
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询