【发布时间】:2014-05-09 17:02:42
【问题描述】:
我尝试使用cin 获取一个字符串作为输入并且它有效,但是当我尝试在字符串之后获取一个int 作为输入时,控制台不会要求它并且程序关闭.这是我的代码:
#include <iostream>
#include <string>
using namespace std;
void main(void)
{
string a, b;
int c, d, e;
cout << "Enter two words \n";
cin >> a, b;
cout << "Enter three int";
cin >> c, d, e;
cout << c*d;
}
这段代码不允许我输入第二个输入,但我可以在程序关闭之前看到第二个输出。
【问题讨论】: