输入

输入未知个元素

 1 #include<stdio.h>
 2 #include<iostream>
 3 using namespace std;
 4 int main(){
 5     int n;
 6     while(scanf("%d",&n)!=EOF){    //空格相间,回车结束 
 7         cout<<"This is: "<<n<<endl;
 8     }
 9     cout<<endl;
10     return 0;
11 }

 

输入带空格string

1 getline(cin,m);

 

posted on 2020-02-05 10:38  yg02  阅读(138)  评论(0编辑  收藏  举报