718a.cpp
来自「C++实训教程」· C++ 代码 · 共 22 行
CPP
22 行
//718a.CPP demo ofstream
#include <iostream.h>
#include <fstream.h>
main(void)
{
char *p="Hi! This is 718a.CPP\n";
ofstream out("718a.bak");
if(!out)
{ cout << "Cannot open file"; return 1; }
out.put(*p);
cout<<p<<"End of 718a.CPP\n";
while(*p){ out.put(*p++); }
out.close( );
return 0;
}
/*Output on screen while runing:
Hi! This is 718a.CPP
End of 718a.CPP
*/
/*and the file 718a.bak's content: ???
HHi! This is 718a.CPP
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?