#54329: c++詳解(附註解)


leon0526@smail.hc.edu.tw (703-3-范子昂Leon)


#include <iostream>
#include <string>

using namespace std;

int main() {
    // 定義一個字串變數來儲存輸入的文字
    string name;

    // 讀取輸入(cin 會讀取到空格或換行為止)
    while (cin >> name) {
        // 輸出固定的 "hello, ",接著輸出變數內容
        cout << "hello, " << name << endl;
    }

    return 0;
}