fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main() {
  5. std::string input;
  6.  
  7. std::cout << "請輸入一行文字:" << std::endl;
  8.  
  9. // 使用 getline 從標準輸入讀取一整行字串
  10. std::getline(std::cin, input);
  11.  
  12. std::cout << "你輸入的是:" << input << std::endl;
  13.  
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5308KB
stdin
app ppl
stdout
請輸入一行文字:
你輸入的是:app ppl