📄 exe12.4.cpp
字号:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
void main()
{
fstream inf,outf;
outf.open("my.dat",ios::out);
if(!outf)
{
cout<<"Can't open file!\n";
abort();
}
outf<<"abcdef"<<endl;
outf<<"123456"<<endl;
outf<<"ijklmn"<<endl;
outf.close();
inf.open("my.dat",ios::in);
if(!inf)
{
cout<<"Can't open file!\n";
abort();
}
char ch[80];
int a(1);
while(inf.getline(ch,sizeof(ch)))
cout<<a++<<':'<<ch<<endl;
inf.close();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -