// PascalABC.NET 3.3, сборка 1579 от 18.11.2017 // Внимание! Если программа не работает, обновите версию!
Нулевой шаг: создание типизированного файла нужной структуры
begin var f:file of real; Assign(f,'MyReal.bin'); Rewrite(f); loop 2 do begin SeqRandomInteger(10,1,100).Select(t->t/10).ForEach(t->Write(f,t)); SeqRandomInteger(10,-100,-1).Select(t->t/10).ForEach(t->Write(f,t)); end; f.Seek(0); // начало файла var b:real; while not Eof(f) do begin Read(f,b); Print(b) end; Println; f.Close end.
begin var f1,f2:file of real; Assign(f1,'MyReal.bin'); Reset(f1); if f1.FileSize mod 20<>0 then begin Writeln('Количество компонент во входном файле не кратно 20'); Exit end; Assign(f2,'MyReal2.bin'); Rewrite(f2); var buf:=new real[5]; var b:real; while not Eof(f1) do begin // переписываем пять положительных loop 5 do begin Read(f1,b); Write(f2,b) end; // считываем пять положительных в буфер for var i:=0 to 4 do Read(f1,buf[i]); // переписываем пять отрицательных loop 5 do begin Read(f1,b); Write(f2,b) end; // пишем пять положительных из буфера foreach var t in buf do Write(f2,t); // переписываем пять отрицательных loop 5 do begin Read(f1,b); Write(f2,b) end end; f1.Close; // контрольное чтение f2.Seek(0); // к началу while not Eof(f2) do begin Read(f2,b); Print(b) end; Writeln; f2.Close end.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int a= Int32.Parse(Console.ReadLine());
int b = Int32.Parse(Console.ReadLine());
int c = Int32.Parse(Console.ReadLine());
int d = Int32.Parse(Console.ReadLine());
int e = Int32.Parse(Console.ReadLine());
int f = Int32.Parse(Console.ReadLine());
int g = Int32.Parse(Console.ReadLine());
int h = Int32.Parse(Console.ReadLine());
b = Math.Max(a, b);
c = Math.Max(b, c);
d = Math.Max(c, d);
e = Math.Max(d, e);
f = Math.Max(e, f);
g = Math.Max(f, g);
h = Math.Max(g, h);
Console.WriteLine(h);
}
}
}