所以我想让用户输入他们的名字和身高。程序不会允许2个输入?
我有其他的代码。
我已经得到了这个。
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int name1;
cout << "What's your name?";
cin >> name1;
int height1;
cout << "What's your height?";
cin >> height1;
return 0;
}
问题是,它不会允许用户输入他们的身高。有任何想法吗?
你'name1'作为'int'。那是错的。另外,'cin >>'输入是空格分隔的。 – crashmstr