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

Most frequent element in array(read info from file) #6

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

viktoriia-fomina
Copy link
Owner

Quick sort is in separate module and reads information from file.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

С точки зрения работы с файлами и модулей всё ок, так что пусть будет зачтена.


tests();

system("pause");

Choose a reason for hiding this comment

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

Нельзя :)

#include <stdio.h>
#include <string.h>

#include <iostream>

Choose a reason for hiding this comment

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

Надо либо iostream, либо stdio, это две библиотеки, делающие по сути одно и то же.

return 0;
}

void mostFrequentElementFromFile(FILE* file)

Choose a reason for hiding this comment

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

Было бы архитектурно лучше, если бы она сама открывала файл и возвращала прочитанные значения, которые потом в main-е передавались бы в mostFrequentElement. Это бы упрочтило переиспользуемость.

}
delete[] temp;
return size;
}

Choose a reason for hiding this comment

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

С этим бы scanf лучше справился :) Тут, например, табуляции в файле всё ломают

fclose(file);
printf("Test 1 passed if result is 0\n");
printf("Test 2 passed if result is 1 or 2 or 3 or 4 or 5\n");
printf("Test 3 passed if result is -34\n");

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