1. 程式人生 > 實用技巧 >思科路由器×××配置-- 動態 site-to-site ×××(上)

思科路由器×××配置-- 動態 site-to-site ×××(上)

#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;
for (int j = 0; j < 3; j++) {
cout << st[i].score[j] << " ";
}
cout << endl; }
delete[]st;
return 0;
}有沒有大佬幫忙看看出錯在哪裡了?