exercises 3.5
1 #include <iostream> 2 #include <string> 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 4 using std::cout; 5 using std::cin; 6 using std::endl; 7 using std::string; 8 9 int main(int argc, char** argv) { 10 11 string temp1,temp2; 12 //结束读取请输入ctrl+z 13 while(getline(cin,temp1)) 14 temp2+=(temp1+" "); 15 16 cout<<temp2<<endl; 17 NULL; 18 return 0; 19 }

浙公网安备 33010602011771号