返回列表 發帖

字串處理 (二) - 字串輸入 1

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.     string str;
  8.     cout<<"輸入一字串: ";
  9.     getline(cin,str);
  10.     cout<<"你剛輸入的字串是: "<<str<<endl;
  11.     system("pause");     
  12.     return 0;   
  13. }
複製代碼

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.         string bang;
  8.         cout<<"輸入字串;";
  9.         getline(cin ,bang);
  10.         cout<<"你輸入的是:"<<bang<<endl;   
  11.         
  12.         system("pause");
  13.         return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.     string str;
  8.     cout<<"輸入一字串: ";
  9.     getline(cin,str);
  10.     cout<<"你剛輸入的字串是: "<<str<<endl;
  11.     system("pause");     
  12.     return 0;   
  13. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.     string a;
  8.     getline(cin, a);
  9.     cout<<a<<endl;
  10.    
  11.     system("pause");
  12.     return 0;   
  13.    
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.     string s;
  8.     cout<<"請輸入隨便一字串:";
  9.     getline(cin,s);
  10.     cout<<"您剛才輸入的字串是:"<<s<<endl;
  11.     system("pause");     
  12.     return 0;   
  13. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.     string s;
  8.     cout<<"輸入一字串:";
  9.     getline(string,s);
  10.     cout<<"你剛輸入的字串是"<<s<<endl;
  11.     system("pause");
  12.     return 0;
  13. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>
  4. using namespace std;
  5. int main()
  6. {
  7.     string jeb;
  8.     cout<<"輸入一字串"<<endl;
  9.     getline(cin,jeb);
  10.     cout<<"您剛輸入der字串是"<<jeb<<endl;
  11.         system("pause");
  12.         return 0;
  13. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. #include<string>  
  4. using namespace std;
  5. int main()
  6. {
  7.    string s;
  8.    cout<<"輸入一字串:";
  9.    getline(cin,s);
  10.    cout<<"你剛輸入的字串是:"<<s<<endl;
  11.    system("pause");
  12.    return 0;
  13. }
複製代碼

TOP

返回列表