-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sigachev week14 #130
base: master
Are you sure you want to change the base?
sigachev week14 #130
Conversation
int Salary; | ||
int Experience; | ||
}; | ||
char* toString(const Teacher& const teacher); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это не компилируется
void print(Student* student, void(*stream)(char*)) | ||
{ | ||
char* buff = new char[255]; | ||
sprintf(buff, "%s %s", student->Name, student->LastName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
дублирование кода. функция toString уже есть
}; | ||
Error set(Course& course, Teacher* teacher); | ||
void unsetTeacher(Course& course); | ||
void remove(Course& course, Student& student); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ссылка на студента должна быть константная
Error set(Course& course, Teacher* teacher); | ||
void unsetTeacher(Course& course); | ||
void remove(Course& course, Student& student); | ||
void add(Course& course, Student& student); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже
void remove(Course& course, Student& student); | ||
void add(Course& course, Student& student); | ||
//void add(Course& course, Student* student); | ||
void print(Course& course); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже и в нижних функция так же
|
||
int getStudentsCount(Course* course) | ||
{ | ||
return course->studentsCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
когда меняется эту переменная, например в методе ремув вроде бы мы удаляем студента и их количество должно измениться, он и там она не меняется
pStudents[i] = course.Students[i]; | ||
pStudents[course.studentsCount + 1] = &student; | ||
course.Students = pStudents; | ||
++course.studentsCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
т.е. при добавлении одного студента, если у нас в группе было 10, после завершения этой функции - станет 20, так как например эта операция выпоняется на каждой итерации цикла. выше операции также не нужно выполнять на каждой итерации
|
||
void print(Course& course) | ||
{ | ||
cout << "Course name: " << course.Name << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
есть функционал по првращщению курса в строку, его и нужно тут использовать. toString
|
||
void print(Course& course, void(*stream)(const char*)) | ||
{ | ||
stream(course.Name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тоже самое, это дублирование кода
} | ||
else | ||
{ | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
функция работает неверно, мы выйдем на первой итерации цикла в любом случае, не проверив всех
No description provided.