This commit is contained in:
Никита Волков 2024-11-19 15:12:02 +04:00
parent b5d021bb51
commit 075f6b3837

24
main1.c Normal file
View File

@ -0,0 +1,24 @@
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <Windows.h>
int a[1000]; //ìàññèâ. 1000 - ìàêñèìàëüíî äîïóñòèìîå êîëè÷åñòâî ýëåìåíòîâ
int n; // Ðåàëüíîå êîëè÷åñòâî ýëåìåíòîâ â ìàññèâå
void Load() {
// Îòêðûòèå âõîäíîãî ôàéëà
FILE* fin = fopen("c:\\lab_19\\in1.txt", "rt");
if (fin == NULL) {
printf("Âõîäíîé ôàéë íå íàéäåí\n");
return;
}
// Çàãðóçêà ìàññèâà èç âõîäíîãî ôàéëà
fscanf_s(fin, "%d", &n);
for (int i = 0; i < n; i++) {
fscanf_s(fin, "%d", &a[i]);
}
// Çàêðûòèå âõîäíîãî ôàéëà
fclose(fin);
}