weixin_45008490 2019-05-03 05:55
浏览 181

Xcode下输入vector1回车或者ctrl+D就return 0 ,无法输入vector2 ,语句中cin.clear()好像没起到作用?

#include
#include

using namespace std;

int main() {

vector<int> ivec1, ivec2;
int ival1, ival2;

cout << "enter numbers for vector 1 : " << endl;
while (cin >> ival1) {
    ivec1.push_back(ival1);
}
cin.clear();

cout << "enter numbers for vector 2 : " << endl;
while (cin >> ival2) {
    ivec2.push_back(ival2);
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
    • ¥15 MCNP里如何定义多个源?
    • ¥20 双层网络上信息-疾病传播
    • ¥50 paddlepaddle pinn
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 请问这个是什么意思?
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services