Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { paulogp }
- Program Ordena;
- Uses
- WinCrt;
- Const
- Max = 10; { Quantidade de Numeros }
- Var
- Valor: Array[1..Max] of Byte;
- I, J, C: Integer;
- Tecla: Char;
- Begin
- Repeat
- ClrScr;
- GotoXY(30, 2);
- WriteLn('ORDENACAO DE ELEMENTOS');
- GotoXY(30, 3);
- WriteLn('~~~~~~~~~~~~~~~~~~~~~~');
- WriteLn;
- WriteLn('Introduza os valores [1,', Max,']: ');
- For I:= 1 to Max do
- Begin
- Write('V[',I,']: ');
- ReadLn(Valor[I]);
- End;
- { Ordena }
- For I:= 2 to Max do
- For J:= 1 to I-1 do
- If Valor[I] < Valor[J] then
- Begin
- C:= Valor[I];
- Valor[I]:= Valor[J];
- Valor[J]:= C;
- End;
- { Escreve }
- WriteLn;
- WriteLn;
- For I:= 1 to Max-1 do Write(Valor[I],',');
- Write(Valor[Max],'.');
- WriteLn;
- WriteLn;
- Write('Repetir (s/n): ');
- Tecla:= ReadKey;
- Until UpCase(Tecla) = 'N';
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement