Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { paulogp }
- { mac os 7 }
- Program Ada_C02;
- uses
- MemTypes, QuickDraw, OSIntf;
- const
- MAX = 10;
- type
- indice = 1..MAX;
- vector = array[indice] of real;
- var
- tecla: string;
- n: indice;
- vn: vector;
- procedure lenum(var n: indice);
- begin
- writeln;
- repeat
- write('Introduza um número Inteiro (n in [1;', MAX, ']): ');
- readln(n);
- if (n < 1) or (n > MAX) then writeln('Leia de novo o que lhe é pedido!!!');
- writeln;
- until (n >= 1) and (n <= MAX);
- end;
- procedure constroivector(var v: vector; n: indice);
- var
- temp: integer;
- begin
- temp:=1;
- while temp <= n do
- begin
- writeln;
- write('Escreva um número real: ');
- readln(v[temp]);
- temp:= temp + 1;
- end;
- end;
- Function maxvector(v: vector; n: indice): real;
- var
- i: integer;
- j: real;
- begin
- j:= v[1];
- for i:= 1 to n do
- if v[i] > j then j:= v[i];
- maxvector:= j;
- end;
- begin
- repeat
- clearscreen;
- gotoxy(25, 2);
- writeln('Programa: Cálculo do Máximo');
- gotoxy(25, 3);
- writeln('---------------------------');
- gotoxy(33, 4);
- writeln('Paulo G.P.');
- writeln;
- lenum(n);
- constroivector(vn, n);
- writeln;
- writeln;
- writeln('Máximo vector: ', maxvector(vn, n):2:1);
- writeln;
- writeln;
- write('Repetir (S/N): ');
- readln(tecla);
- uprstring(tecla, true);
- until tecla = 'N';
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement