Господи, да ! ! 1)дан файл в первой строке файла кол-во чисел. найти ср арифм этих чисел 2)дан файл посчитать кол-во символов в файле 3)дан файл.посчитать кол-во символов в каждой строке исх файла все в паскале и на тему "файлы"
{1} const whereInput = 'C:\Users\1\Desktop\1.txt'; // <== путь файла var input: text; n, n1, i, sum: longint; begin assign(input, WhereInput); reset(input); readln (input, n); n1:=0; sum:=0; for i:=1 to n do begin read (input, n1); inc (sum, n1); end; close (input); write ('Среднее арифметическое: ', sum/n); end.
{2} const whereInput = 'C:\Users\1\Desktop\1.txt'; var input: text; n: longint; ch: char; begin assign(input, WhereInput); reset(input); n:=0; while not eof(input) do begin read (input, ch); inc (n); if eoln(input) then readln(input); end; close (input); write ('Символов в файле: ', n); end.
{3} const whereInput = 'C:\Users\1\Desktop\1.txt'; var input: text; n, i: longint; ch: char; begin assign(input, WhereInput); reset(input); i:=0; n:=0; while not eof(input) do begin read (input, ch); inc (n); if eoln(input) then begin readln(input); inc (i); writeln ('Символов в ', i, ' строке: ', n); n:=0; end; end; close (input); end.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку