commit1
This commit is contained in:
parent
b5d021bb51
commit
075f6b3837
24
main1.c
Normal file
24
main1.c
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user