← C++ 高级程序设计(2020)2020-C++高级程序设计-C++ 输入重定向到文件
发布 更新 约 2 分钟阅读阅读 — 次
- 学习记录
- 2020 年课程笔记
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #include<iostream> #include<string> #include<sstream> #include<fstream> using namespace std; int main() { string str1; string str2; getline(cin, str1); getline(cin, str2); string str = str1 + "\n" + str2; std::ofstream f("D:\\answer\\answer.txt", std::ios::app); f << str << std::endl; f.close(); }
|
1. 考试注意事项
- 多次扩容,嵌套操作
- int输入可能导致内部 long long
评论