void AddSpecificStudent() { string Class, courseID; cout << "Input Class : "; cin >> Class; cout << "Input Course ID: "; cin >> courseID; string s1; ifstream fin("CS162\\Schedule\\2019-2020-HK2-Schedule-"+ Class + ".txt", ios::in); s1 = "CS162\\Schedule\\2019-2020-Schedule-" + Class + ".txt"; if (!fin.is_open()) { cout << "NO"; return; } Course* d = nullptr; int nCourse, nStudent; fin >> nCourse; d = new Course[nCourse]; fin.ignore(); for (int i = 0; i < nCourse; i++) { ReadCourse(fin, d[i]); } fin.close(); ifstream fin2("CS162\\Student\\Student-" + Class + ".txt", ios::in); if (!fin2.is_open()) { cout << "NO2"; return; } Student* s = nullptr; Student temp; int n; fin2 >> n; n++; s = new Student[n]; for (int i = 0; i < n - 1; i++) { fin2.ignore(); ReadStudent(fin2, s[i]); } cout << "INFORMATION STUDENT" << endl; cin.ignore(); cout << "Student ID: "; getline(cin, temp.Account, '\n'); cout << "Student Password: "; getline(cin, temp.Password, '\n'); cout << "Student Full Name : "; getline(cin, temp.FullName, '\n'); cout << "Student Birdthday: "; cin >> temp.DoB.year >> temp.DoB.month >> temp.DoB.day; cout << "Student Class: "; cin.ignore(); getline(cin, temp.Class, '\n'); cout << "Student Gender: "; cin >> temp.Gender; temp.Class = Class; s[n - 1] = temp; Course tem; for (int l = 0;l < n;l++) { if (d[l].courseID == courseID) { tem = d[l]; break; } } ofstream fout2("CS162\\Schedule\\2019-2020-HK2-Schedule-" + Class + '-' + courseID + ".txt", ios::out); if (!fout2.is_open()) { cout << "NO"; return; } fout2 << n << endl; for (int j = 0; j < n; j++) { WriteStudent(fout2, s[j]); WriteAttendance(fout2, tem.Day, tem.startDay, tem.endDay, tem.hourStart, tem.hourEnd); } fout2.close(); fin2.close(); delete[]d; delete[]s; cout << "ADD SPECIFIC STUDENT SUCCESSFULL"; }