Open
Conversation
leshiy1295
requested changes
Oct 13, 2019
Collaborator
leshiy1295
left a comment
There was a problem hiding this comment.
Обнаружен плагиат с работой BoldinDmitry/tech_park_homeworks_c#1
Баллы за обе работы обнуляются
| - cppcheck Resource.h | ||
| - cpplint main.c | ||
| - cpplint Resource.h | ||
| - g++ -g -Wall -Wextra main.c -o main |
Collaborator
There was a problem hiding this comment.
почему для c программы используется g++?
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <assert.h> |
Collaborator
There was a problem hiding this comment.
include-ы стоит располагать в алфавитном порядке
| char* category; | ||
| int count; | ||
| }; | ||
| void resource_init(Resource* resource, char* name, char* callnumber, |
Collaborator
There was a problem hiding this comment.
структуру программы стоит делать следующей:
- интерфейс (прототипы функций)
- main, который не содержит логики и только вызывает функции ввода/инициализации, обработки и вывода/освобождения ресурсов
- реализация интерфейса (определение функций)
| int count; | ||
| }; | ||
| void resource_init(Resource* resource, char* name, char* callnumber, | ||
| char* measure, char* category, int count) { |
Collaborator
There was a problem hiding this comment.
если какие-то параметры не меняются, то нужно это помечать через const
| resource->count = count; | ||
| } | ||
|
|
||
| int compare(const void *resource1, const void *resource2) { |
Collaborator
There was a problem hiding this comment.
тут void * уже не имел смысла, так как функция работает только для Resource
| result_comp = strcmp(res2->measure, res1->measure); | ||
| if (result_comp == 0) { | ||
| return res1->count > res2->count; | ||
| } else { |
| } else { | ||
| return result_comp; | ||
| } | ||
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.