#include #include #include #include using namespace std; /* 001 Hoa (Nu) 8.5 002 Dung Le (Nam) 7.5 003 Nguyen Van Huy (Nam) 10 011 Kim Trang (Nu) 9 017 Hoai Linh (Nam) 10 */ typedef struct Student {//kiểu dữ liệu sinh viên int ID; char Name[20]; char GT[3]; float Score; }SV; typedef struct StudentList {//kiểu danh sách sinh viên int Num; SV a[100]; }DS; void ExtractInformationStudent(DS &ds,char *filename){//trích xuất thông tin sinh viên ifstream f(filename); char str[80]; ds.Num = 0; while (!f.eof()) {//đọc file f.getline(str, 80);//lấy từng dòng char *temp = strtok(str, " "); ds.a[ds.Num].ID = atoi(temp);//lấy ID temp = strtok(0, "("); strcpy(ds.a[ds.Num].Name, temp);//lấy tên temp = strtok(0, ")"); strcpy(ds.a[ds.Num].GT, temp);//lấy giới tính temp = strtok(0, " "); ds.a[ds.Num].Score = atof(temp);//lấy điểm ds.Num++; } } void PrtStudent(DS ds) { cout << "ID\tName\tGT\tScore\n"; for (int i = 0; i < ds.Num; i++) cout << ds.a[i].ID << "\t" << ds.a[i].Name << "\t" << ds.a[i].GT << "\t" << ds.a[i].Score << endl; cout << "\n"; } void ExtractHighScore(DS ds, DS &h) { float max = ds.a[0].Score; int k = 0, m = 0; for (int i = 1; i < ds.Num; i++) //tìm max Score if (ds.a[i].Score > max) { max = ds.a[i].Score; k = i; } for(int i=0;i