思科路由器×××配置-- 動態 site-to-site ×××(上)
阿新 • • 發佈:2020-10-14
#include
#include
using namespace std;
struct student
{
int serial;
char num[20];
char name[20];
char sex;
int score[3];
};
void input(string filename, student *st){ ifstream infile(filename, ios::binary);
if(!infile) {
cout << “not open the file!” << endl; exit(-1); }
int n;
infile.read((char )&n, sizeof(int)); st = new student[n];
infile.read((char)st,(double)n sizeof(student));
infile.close();}
int main()
{ string filename = “D:\deskfile\學生成績表.txt”;
student st = NULL;
input(filename,st);
unsigned int n = sizeof(st) / sizeof(student); for (int i = 0; i < n; i++) {
cout << st[i].serial << " " << st[i].num << " " << st[i].name << " " << st[i].sex;
cout << st[i].score[j] << " ";
}
cout << endl; }
delete[]st;
return 0;
}