mirror of
https://github.com/tiennm99/BTL_KTLT.git
synced 2026-08-11 00:42:20 +00:00
Final version
This commit is contained in:
@@ -43,7 +43,7 @@ inline bool input_name(string &name) {
|
||||
}
|
||||
to_upper(s);
|
||||
for (unsigned int i = 0; i < s.length(); i++) {
|
||||
if (isalpha(s[i]) == 0) {
|
||||
if (isalpha(s[i]) == 0 && s[i] != ' ') {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -386,7 +386,7 @@ bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList& db_st_c
|
||||
}
|
||||
float option;
|
||||
do{
|
||||
cout << "\nChose course to grade or press 0 to exit: ";
|
||||
cout << "\nChose course to grade (input 0 to exit): ";
|
||||
cin >> option;
|
||||
cin.clear();
|
||||
cin.ignore(INT_MAX, '\n');
|
||||
@@ -405,13 +405,12 @@ bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList& db_st_c
|
||||
if (option == i + 1){
|
||||
data = db_st_course_list.findStudentJoinCourse(tc_open_course->list[i].course_id); //lay danh sach sinh vien + diem ma sinh vien tham gia course;
|
||||
if (data->size == 0){
|
||||
cout << "There are no students applied to this course, try again later!\n";
|
||||
cout << "There are no students applied to this course\n";
|
||||
flag = 0;
|
||||
|
||||
cout << "PRESS ENTER TO GO BACK\n";
|
||||
cin.get();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
if (flag == 1){
|
||||
tc.gradingCourse(*data);
|
||||
|
||||
+24
-22
@@ -33,13 +33,12 @@ CourseList* Teacher::tcNotSumCourse(CourseList db_course_list, StudentCourseList
|
||||
return tc_nsumed;
|
||||
}
|
||||
bool Teacher::gradingCourse(StudentCourseList& st_join_course){
|
||||
|
||||
|
||||
int flag = 0;
|
||||
cout << endl;
|
||||
cout << setw(40) << right << "\nStudent List:\n" << endl;
|
||||
cout << setw(5) << left << "STT";
|
||||
cout << setw(30) << left << "MSSV";
|
||||
cout << setw(5) << left << "No.";
|
||||
cout << setw(30) << left << "Student ID";
|
||||
cout << setw(20) << right << "Point\n";
|
||||
cout << setfill('-');
|
||||
cout << setw(55) << "-" << endl;
|
||||
@@ -51,18 +50,18 @@ bool Teacher::gradingCourse(StudentCourseList& st_join_course){
|
||||
}
|
||||
|
||||
if (st_join_course.isGrade()){
|
||||
int index;
|
||||
int a = 0;
|
||||
|
||||
double index;
|
||||
//int a = 0;
|
||||
do{
|
||||
double spoint;
|
||||
|
||||
cout << "Input student's index to modify grade (press 0) to exit: ";
|
||||
cout << "Input student's index to modify grade (input 0 to exit): ";
|
||||
cin >> index;
|
||||
if (cin.fail()) {
|
||||
index = -1;
|
||||
}
|
||||
cin.clear();
|
||||
cin.ignore(INT_MAX, '\n');
|
||||
|
||||
if (index<0 || index>st_join_course.size || cin.bad() || index != (int)index){
|
||||
if (index<0 || index>st_join_course.size || index != (int)index){
|
||||
cout << "Wrong input, try again!\n";
|
||||
continue;
|
||||
}
|
||||
@@ -71,19 +70,22 @@ bool Teacher::gradingCourse(StudentCourseList& st_join_course){
|
||||
break;
|
||||
}
|
||||
do{
|
||||
cout << "Input new grade for " << st_join_course.list[index - 1].st_num << " : ";
|
||||
int i = index;
|
||||
cout << "Input new grade for " << st_join_course.list[i - 1].st_num << " : ";
|
||||
cin >> spoint;
|
||||
if (cin.fail()) {
|
||||
spoint = -1;
|
||||
}
|
||||
cin.clear();
|
||||
cin.ignore(INT_MAX, '\n');
|
||||
if (spoint<-1 || spoint == 11 || spoint == 12 || spoint>13 || cin.bad()){
|
||||
if (spoint < 0 || spoint > 10) {
|
||||
cout << "Wrong input, try again!\n";
|
||||
continue;
|
||||
}
|
||||
st_join_course.list[index - 1].st_point.list[0] = spoint;
|
||||
st_join_course.list[i - 1].st_point.list[0] = spoint;
|
||||
flag++;
|
||||
} while (spoint<-1 || spoint == 11 || spoint == 12 || spoint>13 || cin.bad());
|
||||
|
||||
} while (index != 0||cin.bad());
|
||||
} while (spoint < 0 || spoint > 10 || cin.bad());
|
||||
} while (index != 0 || cin.bad());
|
||||
}
|
||||
|
||||
else{
|
||||
@@ -112,11 +114,11 @@ bool Teacher::gradingCourse(StudentCourseList& st_join_course){
|
||||
spoint = -1;
|
||||
break;
|
||||
}
|
||||
else if (spoint<-1|| spoint>13 || cin.bad()){
|
||||
else if (spoint < 0 || spoint > 10 || cin.bad()){
|
||||
cout << "Wrong input, try again!\n";
|
||||
continue;
|
||||
}
|
||||
} while (spoint<-1|| spoint>13 || cin.bad());
|
||||
} while (spoint < 0 || spoint > 10 || cin.bad());
|
||||
st_join_course.list[i].st_point.list[0] = spoint;
|
||||
n++;
|
||||
}
|
||||
@@ -127,9 +129,9 @@ bool Teacher::gradingCourse(StudentCourseList& st_join_course){
|
||||
//*data = db_st_course_list.findStudentJoinCourse(tc_open_course->list[i].course_id); //lay danh sach sinh vien + diem ma sinh vien tham gia course;
|
||||
cout << endl;
|
||||
//cout << setw(40) << right << "__Danh Sach Sinh Vien Da Dang Ky__\n" << endl;
|
||||
cout << setw(5) << left << "STT";
|
||||
cout << setw(30) << left << "MSSV";
|
||||
cout << setw(20) << right << "Grade\n";
|
||||
cout << setw(5) << left << "No.";
|
||||
cout << setw(30) << left << "Student ID";
|
||||
cout << setw(20) << right << "Point\n";
|
||||
cout << setfill('-');
|
||||
cout << setw(55) << "-" << endl;
|
||||
cout << setfill(' ');
|
||||
@@ -164,7 +166,7 @@ void Teacher::showTeacherCouser(CourseList tc_course,StudentCourseList st_course
|
||||
}
|
||||
}
|
||||
bool Teacher:: openNewCourse(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list){
|
||||
cout << "\t\t______________________OPEN COURSE__________________________\n";
|
||||
cout << "\t\t\t______________________OPEN COURSE__________________________\n";
|
||||
CourseList* sum = new CourseList();
|
||||
CourseList* nsum = new CourseList();
|
||||
sum = tc.tcSumCourse(db_course_list, db_st_course_list);
|
||||
|
||||
Reference in New Issue
Block a user