kurs1
Never
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <Windows.h> typedef struct //Структура специальности { int ID; char name[50]; //имя float konkurs; //конкурс int price; //цена обучения float konkurs_day;//конкурс дневной float konkurs_eve;//вечерний float konkurs_zaoch; }SPEC; //заочный struct UNIVER //основная структура { int ID; char name[50]; //наименование char small_name[8];// сокращённое имя(для имён файлов БД) char adress[50];//адрес SPEC specialnost[50]; } list[300], tmp;//прототип структуры специальности void load(char* base); void open(char* base); void find(); char ch, * file; int err = 0, size = 0; int main(int argc, char* argv[]) { printf("Kyrsovoy proekt stydenta gryppi #113020\n"); printf("Ysnicha Alekseja Urviecha\n"); printf("Press any key to continue...\n\n"); _getch(); open("BASE\\MAIN.BASE"); find(); return 0; } void load(char* base) { int j = 0; char* fName = "BASE.TXT"; FILE* f = fopen(base, "r"); FILE* f2; while (!feof(f)) { fscanf(f, "%u %s %s %s", &tmp.ID, &tmp.name, &tmp.small_name, &tmp.adress); if (strcmp(tmp.name, "") != 0) { f2 = fopen(fName, "r"); list[j].ID = tmp.ID; strcpy(list[j].name, tmp.name); strcpy(list[j].small_name, tmp.small_name); strcpy(list[j].adress, tmp.adress); //list[j].price=tmp.price; int i = 0; while (!feof(f2)) { fscanf(f2, "%u %s %f %u %f %f %f", &tmp.specialnost[0].ID, &tmp.specialnost[0].name, &tmp.specialnost[0].konkurs, &tmp.specialnost[0].price, &tmp.specialnost[0].konkurs_day, &tmp.specialnost[0].konkurs_eve, &tmp.specialnost[0].konkurs_zaoch); list[j].specialnost[i].ID = tmp.specialnost[0].ID; strcpy(list[j].specialnost[i].name, tmp.specialnost[0].name); list[j].specialnost[i].price = tmp.specialnost[0].price; list[j].specialnost[i].konkurs_day = tmp.specialnost[0].konkurs_day; list[j].specialnost[i].konkurs_eve = tmp.specialnost[0].konkurs_eve; list[j].specialnost[i].konkurs_zaoch = tmp.specialnost[0].konkurs_zaoch; list[j].specialnost[i].konkurs = tmp.specialnost[0].konkurs; i++; } j++; fclose(f2); } } fclose(f); } void loadMan() { system("cls"); int count_spec = 0; int count_vyz = 0; printf("Kollichestvo VYZov: "); scanf_s("%d", &count_vyz); for (int i = 0; i < count_vyz; i++) { list[i].ID = i + 1; printf("ID: ", list[i].ID); printf("Nazvanie: "); fgets(list[i].name, 50, stdin); printf("Sokraschennoe imja: "); fgets(list[i].small_name, 8, stdin); printf("Adress: "); fgets(list[i].adress, 50, stdin); printf("Kollichestvo specialnostey: "); scanf_s("%d", &count_spec); for (int j = 0; j < count_spec; j++) { list[i].specialnost[j].ID = j + 1; printf("ID: %d", list[i].specialnost[j].ID); printf("Nazvanie: "); fgets(list[i].specialnost[j].name, 50, stdin); printf("Obschiy konkyrs: "); scanf_s("%f", &list[i].specialnost[j].konkurs); printf("Cena obychenija: "); scanf_s("%d", &list[i].specialnost[j].price); printf("Dnevnoy konkyrs: "); scanf_s("%f", &list[i].specialnost[j].konkurs_day); printf("Vecherniy konkyrs: "); scanf_s("%f", &list[i].specialnost[j].konkurs_eve); printf("Zaochniy konkyrs: "); scanf_s("%f", &list[i].specialnost[j].konkurs_zaoch); } } } void open(char* base) { system("cls"); printf("Viberite metod vvoda ishodnih dannyh\n"); printf("1. Zagruzka is faila \n"); printf("2. Vrychnyu \n"); printf("3. Vihod \n\n"); do ch = _getch(); while ((ch != '1') && (ch != '2') && (ch != '3') && (ch != '4')); switch (ch) { case '1': load(base); break; case '2': loadMan(); break; case '3': exit(0); break; default: exit(0); system("cls"); printf("Viberite deystvie:\n"); printf("1. Poisk \n"); printf("2. Vihod\n"); do ch = _getch(); while ((ch != '1') && (ch != '2')); switch (ch) { case '1': find(); break; case '2': exit(0); break; default: exit(0); } } } void find() { system("cls"); printf("Viberite metod poiska\n"); printf("1. Vse o dannom vyze\n"); printf("2. Vse o dannoi specialnosti\n"); printf("3. Minimalniy konkyrs dla dannoy specialnosti\n"); printf("4. Minimalniy konkyrs\n"); printf("5. Vihod\n"); do ch = _getch(); while ((ch != '1') && (ch != '2') && (ch != '3') && (ch != '4')); switch (ch) { case '1': { system("cls"); bool found = false; printf("Nazvanie(korotkoe): "); fgets(tmp.small_name, 8, stdin); for (int i = 0; i < 300; i++) { if (!strcmp(list[i].small_name, tmp.small_name)) { int j = 0; printf("ID: %d\n", list[i].ID); printf("Nazvanie: %s\n", list[i].name); printf("Adress: %s\n", list[i].adress); printf("Spezialnosti: \n"); while (list[i].specialnost[j].ID != 0) { printf(" - %s\n", list[i].specialnost[j].name); j++; } found = true; break; } } if (!found) printf("Nichego ne naydeno\n"); break; } case '2': { system("cls"); bool found = false; printf("ID vyza: "); scanf_s("%d", &tmp.ID); printf("ID zpecialnosti: "); scanf_s("%d", &tmp.specialnost[0].ID); for (int i = 0; i < 300; i++) { if (list[i].ID == tmp.ID) { for (int j = 0; j < 50; j++) { if (list[i].specialnost[j].ID == tmp.specialnost[0].ID) { printf("ID: %d\n", list[i].specialnost[j].ID); printf("Nazvanie: %s\n", list[i].specialnost[j].name); printf("Obschiy konkyrs: %f\n", list[i].specialnost[j].konkurs); printf("Cena obychenija: %d\n", list[i].specialnost[j].price); printf("Dnevnoy konkyrs: %f\n", list[i].specialnost[j].konkurs_day); printf("Vecherniy konkyrs: %f\n", list[i].specialnost[j].konkurs_eve); printf("Zaochniy konkyrs: %f\n", list[i].specialnost[j].konkurs_zaoch); found = true; break; } } break; } } if (!found) printf("Nichego ne naydeno\n"); break; } case '3': { system("cls"); bool found = false; float min = 33554424.000; printf("ID vyza: "); scanf_s("%d", &tmp.ID); printf("ID zpecialnosti: "); scanf_s("%d", &tmp.specialnost[0].ID); for (int i = 0; i < 300; i++) { if (list[i].ID == tmp.ID) { for (int j = 0; j < 50; j++) { if (list[i].specialnost[j].ID == tmp.specialnost[0].ID) { if (list[i].specialnost[j].konkurs_day < min) min = list[i].specialnost[j].konkurs_day; if (list[i].specialnost[j].konkurs_eve < min) min = list[i].specialnost[j].konkurs_eve; if (list[i].specialnost[j].konkurs_zaoch < min) min = list[i].specialnost[j].konkurs_zaoch; found = true; break; } } } } if (!found) printf("Nichego ne naydeno\n"); else printf("Minimalniy konkyrs: %f\n", min); break; } case '4': { system("cls"); float min = 33554424.000; for (int i = 0; i < 300; i++) { if (list[i].name == "") break; for (int j = 0; j < 50; j++) { if (list[i].specialnost[j].konkurs < min && list[i].specialnost[j].ID != 0) min = list[i].specialnost[j].konkurs; } } printf("Minimalniy konkyrs: %f\n", min); break; } case '5': exit(0); break; default: exit(0); } _getch(); //open(base); } //---------------------------------------------------------------------------
Raw Text
-
BRAZZERS - Robbin Banx & MJ Fresh Get On Stage And Share Duncan's Delicious Cock In A Hot 3
6 min ago
-
Untitled
9 min ago
-
Discover Your Perfect Wedding Venue in Karnal near Delhi with CYJ Events
17 min ago
-
Les Guetteurs Film Complet en Streaming VF
19 min ago
-
Untitled
21 min ago
-
https://go90-keto-gummies-get.company.site/
25 min ago
-
Untitled
30 min ago
-
Annie Rivieccio - This Pro Female Bodybuilder Is Naked. And In Control.
37 min ago
-
Threesome at the Hair Salon - Cuckold Boyfriend Picks Her Up (English Subtitles) - DivinaMaruuu
1 hour ago
-
Untitled
1 hour ago