📄 11_8.cpp
字号:
//11_8.cpp
#include <fstream.h>
#include <fcntl.h>
#include <io.h>
void main()
{
struct
{
double salary;
char name[23];
} employee;
ifstream is("payroll",ios::binary | ios::nocreate);
if (is)
{
is.read((char *) &employee,sizeof(employee));
cout << employee.name << ' ' << employee.salary << endl;
}
else
{
cout << "ERROR: Cannot open file 'payroll'." << endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -