All pastes #244643 Raw Edit

Something

public text v1 · immutable
#244643 ·published 2006-11-10 00:40 UTC
rendered paste body
Procedure F_Cadastra_clientes ( var arquivo : Tarquivo );



var
  registro : Tregistro;
  posicao : integer;

begin
  registro.saldo := 0;
  registro.valor_usado :=0;

  posicao := filepos ( arquivo );

  seek ( arquivo, posicao );

  writeln('Informe o nome do cliente.');
  readln(registro.nome_do_cliente);

  while ( registro.nome_do_cliente <> '' ) do
  begin
    registro.limite_de_credito := 0;
    writeln('Informe o numero da conta.');
    readln(registro.numero_da_conta);
    writeln('Informe o tipo da conta. C - Comum ou E - Especial');
    readln(registro.tipo_da_conta);

    if ( upcase( registro.tipo_da_conta ) = 'E' ) then
    begin
      writeln('Informe o limite de credito.');
      readln(registro.limite_de_credito);
    end;

    write( arquivo , registro );

    writeln('Informe o nome do cliente.');
    readln(registro.nome_do_cliente);

  end;

  //tetstando se o arquivo ta escrevendo certo
  seek ( arquivo , 0 );
  while not EOF ( arquivo ) do
  begin
    writeln('Nome: ' , registro.nome_do_cliente);

  end;