Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

sigachev week14 #130

wants to merge 1 commit into from

Conversation

SigachevSergey
Copy link
Collaborator

No description provided.

int Salary;
int Experience;
};
char* toString(const Teacher& const teacher);
Copy link
Owner

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);
Copy link
Owner

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);
Copy link
Owner

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);
Copy link
Owner

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);
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тоже самое, это дублирование кода

}
else
{
return false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

функция работает неверно, мы выйдем на первой итерации цикла в любом случае, не проверив всех

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants