This repository has been archived on 2026-07-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
college-work/Задания по C и C++/с (2024)/С(2024)/19.c
T

43 lines
1014 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
srand(time(NULL));
FILE *fn_a = fopen("netext_a.bin", "wb");
if (fn_a == NULL) {
perror("Error opening file netext_a.bin");
return 1;
}
for (int i = 1; i <= 100; i++) {
char n = -50 + rand() % 151;
fwrite(&n, sizeof(char), 1, fn_a);
}
fclose(fn_a);
FILE *fn_b = fopen("netext_b.bin", "wb");
if (fn_b == NULL) {
perror("Error opening file netext_b.bin");
return 1;
}
for (int i = 1; i <= 100; i++) {
char n = -50 + rand() % 151;
fwrite(&n, sizeof(char), 1, fn_b);
}
fclose(fn_b);
FILE *fn_v = fopen("netext_v.bin", "wb");
if (fn_v == NULL) {
perror("Error opening file netext_v.bin");
return 1;
}
for (int i = 1; i <= 100; i++) {
char n = -50 + rand() % 151;
fwrite(&n, sizeof(char), 1, fn_v);
}
fclose(fn_v);
return 0;
}