Skip to content

Work branch#1

Open
SPetrenko17 wants to merge 8 commits intomasterfrom
work_branch
Open

Work branch#1
SPetrenko17 wants to merge 8 commits intomasterfrom
work_branch

Conversation

@SPetrenko17
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown
Collaborator

@leshiy1295 leshiy1295 left a comment

Choose a reason for hiding this comment

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

Обнаружен плагиат с работой BoldinDmitry/tech_park_homeworks_c#1
Баллы за обе работы обнуляются

- cppcheck Resource.h
- cpplint main.c
- cpplint Resource.h
- g++ -g -Wall -Wextra main.c -o main
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

почему для c программы используется g++?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

include-ы стоит располагать в алфавитном порядке

char* category;
int count;
};
void resource_init(Resource* resource, char* name, char* callnumber,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

структуру программы стоит делать следующей:

  • интерфейс (прототипы функций)
  • main, который не содержит логики и только вызывает функции ввода/инициализации, обработки и вывода/освобождения ресурсов
  • реализация интерфейса (определение функций)

int count;
};
void resource_init(Resource* resource, char* name, char* callnumber,
char* measure, char* category, int count) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

если какие-то параметры не меняются, то нужно это помечать через const

resource->count = count;
}

int compare(const void *resource1, const void *resource2) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

тут void * уже не имел смысла, так как функция работает только для Resource

result_comp = strcmp(res2->measure, res1->measure);
if (result_comp == 0) {
return res1->count > res2->count;
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

else не нужен

} else {
return result_comp;
}
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

else не нужен

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