C++里关于cout和cin的简单问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 19:19:21
如果我需要运用程序的人输入多少英尺多少英寸,能不能在一条命令中直接取得?
int feet, inches;
cout<<"Please enter your high in feet and inches: ";
cin>>feet, inches;
这样好像只能取到一个数...望赐教啊!

cin>>feet>>inches;

只能分别输入。

多看看书吧,基础还是很重要的哈
cin >> feet >> inches;
要想输入多个变量,要在变量加输入流符就可以了呵,不是逗号呵

建议您用scanf
scanf("%d,%d",&feet,&inches);
您就可以这样输入了:1,2