Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 获取用户输入_C++_Input - Fatal编程技术网

C++ 获取用户输入

C++ 获取用户输入,c++,input,C++,Input,我在这条线上有个问题 cout << "Please input how many hours your pool pump ran this month: "; cin.get(hours,15); cin.ignore(80,'\n'); cout您应该这样做: int hours = 0; cout << "Please input how many hours your pool pump ran this month: " cin >> hou

我在这条线上有个问题

cout << "Please input how many hours your pool pump ran this month: ";

cin.get(hours,15);

cin.ignore(80,'\n');

cout您应该这样做:

int hours = 0;
cout << "Please input how many hours your pool pump ran this month: "
cin >> hours;
int小时=0;
不能>小时;
有关代码未按预期工作的原因,请查看
cin.get()
cin.ignore()
文档: