int FindCourse(Course* c, int n,string s) { for (int i = 0;i < n;i++) { if (s == c[i].courseID) return i; } return -1; } void WriteInfo(Course c) { cout <<" 1-Course ID: " << c.courseID << endl; cout <<" -Course Name: "<< c.courseName << endl; cout <<" 2-Lecturer User: "<< c.lecturerUser << endl; cout <<" -Lecturer Name: "<< c.lecturerName << endl; cout <<" -lecturer Degree: "<< c.lecturerDegree << endl; cout <<" -lecturer Gender: "<< c.lecturerGender << endl; cout <<" 3-startDay: " << c.startDay << endl; cout <<" -endDay: " << c.endDay << endl; cout <<" -Day: " << c.Day << endl; //int cout <<" -hourStart: " << c.hourStart << endl; cout <<" -Hour End: " << c.hourEnd << endl; cout <<" 4-Room: " << c.Room << endl; } void ChangeCourse(Course& c, int s) { if (s == 1) { cout << " Press New Course ID: " << endl; getline(cin, c.courseID, '\n'); cout << " Press New Course Name: " << endl; getline(cin, c.courseName, '\n'); } else if (s == 2) { cout << " Press New Lecturer User: " << endl; getline(cin, c.lecturerUser, '\n'); cout << " Press New Lecturer Name: " << endl; getline(cin, c.lecturerName, '\n'); cout << " Press New Lecturer Degree: " << endl; getline(cin, c.lecturerDegree, '\n'); cout << " Press New Lecturer Gender: " << endl; cin >> c.lecturerGender; } else if (s == 3) { cout << " Press New Start Day: " << endl; getline(cin, c.startDay, '\n'); cout << " Press New End Day: " << endl; getline(cin, c.endDay, '\n'); cout << " Press New Day: " << endl; cin >> c.Day; cin.ignore(); cout << " Press New Hour Start: " << endl; getline(cin, c.hourStart, '\n'); cout << " Press New Hour End: " << endl; getline(cin, c.hourEnd, '\n'); } else if (s == 5) { cout << " Press New Room: " << endl; getline(cin, c.Room, '\n'); } } void FixCourse(Course& c) { cout << "Infomation: " << endl; WriteInfo(c) int s; cout << " Press number change: "; cin << s; ChangeCourse(c, s); } void EditCourse(Course*& c, int& n) { ReadFileCourse(c, n); cout << "Edit Course" << endl; cin.ignore(); string s; cout << "Course ID: "; getline(cin, s, '\n'); if (FindCourse(c, n, s) == -1) cout << "Course isn't existing"; else FixCourse(c[FindCourse(c, n, s)]); WriteFileCourse(c, n); }