参考博客: https://www.cnblogs.com/hdk1993/p/5853233.html // writing on a text file #include <fiostream.h> int main () { ofstream out("out.txt"); if (out.