Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {Генерирует числа, находит наибольшее и наименьшее, удаляет последнее. К сожалению, всё.}
- program tip;
- uses crt;
- var
- f: file of integer;
- a1, n, i, amax, nmax, na, amin, nmin : integer;
- begin
- clrscr;
- writeln ('Vvod kolichestva chisel');
- readln (n);
- assign (f, 'file.int');
- rewrite (f);
- randomize;
- for i := 1 to n do begin
- a1:=Random (100);
- write (f, a1);
- end;
- reset (f);
- clrscr;
- for i :=1 to n do begin
- read (f, a1);
- writeln (a1);
- end;
- reset (f);
- amax:=-1;
- amin:=101;
- while not eof(f) do begin
- read (f, a1);
- if a1 > amax then begin
- amax:=a1;
- nmax:=filepos (f);
- end;
- if a1<amin then begin
- amin:=a1;
- nmin:=filepos (f);
- end; end;
- writeln ('max = ', amax, ' nmax = ', nmax);
- writeln ('min = ', amin, ' nmin = ', nmin);
- seek (f, nmax-1);
- read (f, a1);
- seek (f, n);
- write (f, a1);
- i:=n+1;
- na:=nmax;
- reset (f);
- seek (f, n-1);
- truncate (f);
- reset (f);
- while not eof(f) do begin
- read (f, a1);
- writeln (a1);
- end;
- close (f);
- readln;
- clrscr;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement