读入一行int(只知道读入一行,不知道具体的个数时使用) int t,i=0; while(cin>>t){ a[i++]=t; if(cin.get()=='/n')break; } 读入一行string(当要读入的数据中含有空格时使用) string s; getline(cin,s);