求大神指点,为什么用c++编的程序输出结果后直接就自动退出了?

2025-04-03 22:13:49
推荐回答(1个)
回答1:

cin.get()会读取cin>>numb中输入时的回车符,读入回车就直接返回了。

试试这样行不行:

#include;
#include;
using namespace std;
int main()
{
int numa;
int numb;
cout<<"a = :"< cin>>numa;
cin>>numb;
cout<<"he :"< cin>>numb;
return 0;
}