Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TPerson VvodInfoGen(FILE *f, TPerson human) {
- fscanf_s(f, "%s", human.NAME.F, sizeof human.NAME.F);
- if (strncmp(human.NAME.F, "**", 2) == 0) return human;
- fscanf_s(f, "%s", human.NAME.I, sizeof human.NAME.I);
- fscanf_s(f, "%s", human.NAME.O, sizeof human.NAME.O);
- fscanf_s(f, "%2d", &human.DATA.Db);
- fscanf_s(f, "%2d", &human.DATA.Mb);
- fscanf_s(f, "%4d", &human.DATA.Yb);
- fscanf_s(f, "%2d", &human.DATA.Dd);
- fscanf_s(f, "%2d", &human.DATA.Md);
- fscanf_s(f, "%4d", &human.DATA.Yd);
- human = CorrectPers(human);
- return human;
- }
- void addgen(FILE *tr, FILE *f) {
- TPerson human{};
- human = VvodInfoGen(f, human);
- if (!feof(f) && strcmp(human.NAME.F, "**") != 0) {
- tr = createleft(tr, human);
- addgen(tr, f);
- tr = makecurrentparent(tr);
- }
- human = VvodInfoGen(f, human);
- if (!feof(f) && strcmp(human.NAME.F, "**") != 0) {
- tr = createright(tr, human);
- addgen(tr, f);
- tr = makecurrentparent(tr);
- }
- }
- //----------третья часть: создать неупорядоченное бинарное дерево из текстового файла----------
- FILE *CreateNotOrdered(FILE *tr) {//функция, которая создаёт неупорядоченное бинарное дерево
- bool flag = true;
- int count = 0;
- FILE *f;
- TPerson human{};
- f = fopen("dat.txt", "r");
- tr = fopen("tree", "r+");
- human = VvodInfoGen(f, human);
- tr = createnull(human);
- addgen(tr, f);
- tr = makecurrent(tr);
- fclose(f);
- fclose(tr);
- return tr;
- }
Advertisement
Add Comment
Please, Sign In to add comment