-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Most frequent element in array(read info from file) #6
Conversation
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.
С точки зрения работы с файлами и модулей всё ок, так что пусть будет зачтена.
|
||
tests(); | ||
|
||
system("pause"); |
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.
Нельзя :)
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include <iostream> |
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.
Надо либо iostream, либо stdio, это две библиотеки, делающие по сути одно и то же.
return 0; | ||
} | ||
|
||
void mostFrequentElementFromFile(FILE* file) |
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.
Было бы архитектурно лучше, если бы она сама открывала файл и возвращала прочитанные значения, которые потом в main-е передавались бы в mostFrequentElement. Это бы упрочтило переиспользуемость.
} | ||
delete[] temp; | ||
return size; | ||
} |
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.
С этим бы 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"); |
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.
Тесты должны быть автоматическими
Quick sort is in separate module and reads information from file.