Recent

Author Topic: [UNSOLVED] repeat until , GotoXY  (Read 2439 times)

whitehat

  • Jr. Member
  • **
  • Posts: 93
[UNSOLVED] repeat until , GotoXY
« on: December 09, 2016, 09:26:22 pm »
when i execute my program this error message show up (project1.lpr(43,3) Fatal: Syntax error, "UNTIL" expected but "REPEAT" found ")

PROGRAM a;
uses crt;
type enreg=record
 nom,sign:string[90];
 nat:char;
end;
fiche=file of enreg;
var
f1:fiche;
f2,f3:text;
rep:integer;

procedure menu;
begin
ClrScr;
 GotoXY(39,2);
 write('MENU');
 GotoXY(39,3);
 write('_':length('menu'));
 GotoXY(1,6);
 write('1-remlir le fichier f1');
 GotoXY(1,8);
 write('2-ajouter un nouveau terme dans le fichier');
 GotoXY(1,10);
 write('3-supprmer un terme saisir');
 GotoXY(1,12);
 write('4-remplir un fichier texte f2 par le mot palind');
 GotoXY(1,14);
 write('5-remplir un fichier contient les mots specifiques');
 GotoXY(1,16);
 write('6-quiter');
end;



{pp}
begin
 assign(f1,'C:\bec\fglossaire.dat');
 assign(f2,'C:\bec\fpalind.txt');
 assign(f3,'C:\bec\fres.txt');
 repeat
  menu
  repeat
   GotoXY(79,20)
   readln(rep);
  until(rep in[1..6]);
  case of rep do
   1:remplir(f1);
   2:ajout(f1);
   3:supp(f1);
   4:transfert1(f1,f2);
   5:transfert2(f1,f3);
   6: done wincrt;
  end;
 until (rep=6);
end.

lainz

  • Hero Member
  • *****
  • Posts: 4741
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: [UNSOLVED] repeat until , GotoXY
« Reply #1 on: December 09, 2016, 09:32:33 pm »
Some missing ";" and wrong order of case..of

In the 6 of case there's another problem, or I don't get what is "done wincrt", I almost never do command line applications.

Code: Pascal  [Select][+][-]
  1. PROGRAM a;
  2. uses crt;
  3. type enreg=record
  4.  nom,sign:string[90];
  5.  nat:char;
  6. end;
  7. fiche=file of enreg;
  8. var
  9. f1:fiche;
  10. f2,f3:text;
  11. rep:integer;
  12.  
  13. procedure menu;
  14. begin
  15. ClrScr;
  16.  GotoXY(39,2);
  17.  write('MENU');
  18.  GotoXY(39,3);
  19.  write('_':length('menu'));
  20.  GotoXY(1,6);
  21.  write('1-remlir le fichier f1');
  22.  GotoXY(1,8);
  23.  write('2-ajouter un nouveau terme dans le fichier');
  24.  GotoXY(1,10);
  25.  write('3-supprmer un terme saisir');
  26.  GotoXY(1,12);
  27.  write('4-remplir un fichier texte f2 par le mot palind');
  28.  GotoXY(1,14);
  29.  write('5-remplir un fichier contient les mots specifiques');
  30.  GotoXY(1,16);
  31.  write('6-quiter');
  32. end;
  33.  
  34.  
  35.  
  36. {pp}
  37. begin
  38.  assign(f1,'C:\bec\fglossaire.dat');
  39.  assign(f2,'C:\bec\fpalind.txt');
  40.  assign(f3,'C:\bec\fres.txt');
  41.  repeat
  42.   menu();
  43.   repeat
  44.    GotoXY(79,20);
  45.    readln(rep);
  46.   until(rep in[1..6]);
  47.   case rep of
  48.    1:remplir(f1);
  49.    2:ajout(f1);
  50.    3:supp(f1);
  51.    4:transfert1(f1,f2);
  52.    5:transfert2(f1,f3);
  53.    6: done wincrt;
  54.   end;
  55.  until (rep=6);
  56. end.  

Thaddy

  • Hero Member
  • *****
  • Posts: 18765
  • To Europe: simply sell USA bonds: dollar collapses
Re: [UNSOLVED] repeat until , GotoXY
« Reply #2 on: December 09, 2016, 09:38:54 pm »
Yup menu; GotoXY(79,20); case rep of
And the whole case loop has missing functions. Bad code that should have been solved on the basis of the very clear compiler messages.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

whitehat

  • Jr. Member
  • **
  • Posts: 93
Re: [UNSOLVED] repeat until , GotoXY
« Reply #3 on: December 09, 2016, 09:39:18 pm »
thx you man  :D

 

TinyPortal © 2005-2018