Jump to content

Recommended Posts

Posted

Boas, tenho programaçao a quase um ano e tenho de fazer um programa tipo agenda electronica..

entao comecei a trabalhar mas nao consigo compilar..

se alguem poder ajudar agradeço..

Uso o FreePascal e o TurboPascal.. ambos dao o mesmo erro:

projpsi.pas(20,16) Fatal: Syntax error, ":" expected but "(" found

projpsi.pas(0) Fatal: Compilation aborted

program agendaXY;

uses dos,crt;

const

Ficheiro='d:\agndtext.txt';

type

        reg = record

        data:string[10];

        hora:string[8];

        obs:string[30];

end;

var

        agenda:file of reg;

        opcao:char;

procedure add;

Var

  x:reg;

        rewrite(agenda);

        while not eof (agenda) do

        begin

            read(agenda,x);

        end;

        repeat

            clrscr;

            writeln('        -----\Adicionar Tarefa/-----');

            with x do

            begin

                write('data [dd/mm/aa]'); readln(data);

                write('hora'); readln(hora);

                write('observacoes'); readln(obs);

        end;

        write(agenda,x);

        close(agenda);

procedure con;

var

  x:reg;

      clrscr;

      reset(agenda);

      while not eof(agenda) do

      begin

          read(agenda,x);

          write('=============| Todas as tarefas |=============');

          writeln;

          with x do

          begin

              writeln('data: ',data');

              writeln('hora: ',hora');

              writeln('observacoes: ',obs');

          end;

      readkey;

      end;

procedure pesq;

var

  x:reg;

  data2:string[10];

  clrscr;

  reset(agenda);

  clrscr;

  Write('=============| Pesquisar |=============');

  write;

  write('Digite a Data [dd/mm/aa]'); readln(data2);

  writeln;

  while not eof(agenda) do

  begin

      read(agenda,x);

      with x do

      if dia = dia2 then

      writeln('Data: ',data);

      writeln('Hora: ',hora);

      writeln('observacoes: ',obs);

  end;

  readkey;

procedure rem;

var

  x:reg;

data2:string[10];

  clrscr;

  reset(agenda);

  clrscr;

  Write('=============| Remover |=============');

  write;

  write('Digite a Data [dd/mm/aa]'); readln(data2);

  writeln;

  while not eof(agenda) do

  begin

      read(agenda,x);

      with x do

      if data = data2 then

      dara := '';

      hora := '';

      obs := '';

  end;

  readkey;

begin

clrscr;

assign(agenda,ficheiro);

repeat

repeat

clrscr;

    writeln('========================================================');

    writeln;

    writeln('            -----\Agenda Electronica/-----');

    writeln;

    writeln('========================================================');

    writeln;

    writeln(' Escolha uma das opcoes abaixo');

    writeln;

    writeln(' [ 1 ] - Adicionar Tarefa');

    writeln(' [ 2 ] - Consultar Todas as Tarefas');

    writeln(' [ 3 ] - Pesquisar tarefas');

    writeln(' [ 4 ] - Remover Tarefa');

    writeln(' [ 5 ] - Sair');

    writeln;

opcao := readkey;

Until (opcao >= '1') and (opcao <= '5');

Case opcao of

'1' : add;

'2' : con;

'3' : pesq;

'4' : rem;

end;

Until (opcao = '5');

  begin

      clrscr;

      Writeln('  ===================\ BYE /===================');

      Delay(1000);

  end;

end.

Posted

Well ja consegui corrigir o erro e ja consigo compilar o programa..

So a parte do remover e q nao funcionar, mas estou a trabalhar nisso..

obrigado pessoal..

😄😛

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.