Ver Mensaje Individual
  #8  
Antiguo 14-08-2007
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 22
cHackAll Va por buen camino
Código Delphi [-]
uses Windows, SysUtils; {$apptype console}
var
 Handle: Cardinal;                                             // El manejador de la consola
 Info: TConsoleScreenBufferInfo;                               // Para GotoXY, WhereX, y WhereY
 Repeticiones, Cantidad: ShortInt;
 Choice: Char;
begin
 Handle := GetStdHandle(STD_OUTPUT_HANDLE);
 repeat Write('Introduce las longitudes del diagrama de barras a representar: ');
  ReadLn(Repeticiones);
  while Repeticiones > 0 do
   begin
    Dec(Repeticiones);
    ReadLn(Cantidad);

    GetConsoleScreenBufferInfo(Handle, Info);                  // Para obtener la posicion actual del cursor (WhereX & WhereY)
    Info.dwCursorPosition.X := 16;                             //
    Dec(Info.dwCursorPosition.Y);                              //
    SetConsoleCursorPosition(Handle, Info.dwCursorPosition);   // Para definit la nueva posicion del cursor (GotoXY(16, WhereY - 1)

    if Cantidad > -1 then
     Write('I');
    while Cantidad > 0 do
     begin
      Write('*');
      Dec(Cantidad);
     end;
    WriteLn;
   end;
  WriteLn;
  Write('Deseas representar mas diagramas de barras (S/N): ');
  ReadLn(Choice);
 until (Choice <> 's') and (Choice <> 'S');
end.

Bueno ya que no puedes usar un goto label; entonces te dejo la solucion obvia y le agrego un toque visual agradable...

Última edición por cHackAll fecha: 14-08-2007 a las 21:24:29.
Responder Con Cita