C++的输入
①以空格分割输入内容:#include <iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout<<"你刚才输入了:"<<x<<" "<<y<<endl;
return 0;
}
②带空格输入(即将空格也理解为一个字符):
#include <iostream>
using namespace std;
int main(){
char a;
cin.getline(a,10);
cout<<"你刚才输入了:";
for (int i=0;i<10;i++){
cout<<a;
}
return 0;
}
https://blog.51cto.com/u_15467636/4864099
页:
[1]