#3257. [GESP202512 四级 C++] 第 14 题

[GESP202512 四级 C++] 第 14 题

执行下面 C++ 程序,会输出( )。

int main() {
    ofstream fout("test.txt");
    fout << "Happy" << endl;
    fout << "New Year";
    fout.close();

    ifstream fin("test.txt");
    string s1, s2;
    fin >> s1;
    getline(fin, s2);
    fin.close();

    cout << s1 << "|" << s2;
    return 0;
}

{{ select(1) }}

  • Happy|New Year
  • Happy| New Year
  • HappyNew Year|
  • Happy|