Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Question!


Name: Yassine
Title:
  program shutting down
Question:
this program shuts down saying runtime error 202 .what should i do ? please help.. thanks in advance.
Answers:

Name: yassine
here is the program :
program bac_2017;
uses wincrt;
type tab1=array[1..100] of string;
tab2=array[1..100]of integer;
var t1:tab1; t2,tchoix:tab2; i,j,np:integer; b:boolean;
procedure entrer(var np:integer; var t1:tab1; var tchoix:tab2)   ;
var nbalpha,nbesp:integer ;
begin
for i:=1 to 5 do begin
                 writeln('t1[',i,']=');
                   repeat
                 readln(t1[i]);
                 nbesp:=0;nbalpha:=0; b:=false;
                 for j:=1 to length (t1[i]) do
                 if upcase(t1[i,j]) in ['A'..'Z'] then nbalpha:=nbalpha 1
                 else if t1[i][j] = ' ' then nbesp:=nbesp 1;
                 if nbesp nbalpha=length (t1[i]) then b:=true
                   until b=true;
                 end;
writeln ('entrer le nombre de participants');
                 repeat readln(np)
                 until np in [5..100];
writeln( 'indiquer le choix de chaque participant');
for i:=1 to np do begin 
                  write ('le choix du participant n°',i,' =');
                  repeat
                  readln(tchoix[i]);
                  until  tchoix[i] in [1..5];
                  end;
end;
procedure former (var t2:tab2); begin
for j:= 1 to 5 do begin
                  for i:= 1 to np do
                  if tchoix[i]=j then t2[j]:=t2[j] 3;
                  end;
                                end;
procedure afficher (t2:tab2; t1:tab1 );
var ch:string ; max:integer;
begin
j:=1;
     repeat                 
max:=-1 ;ch:='';
for i := 1 to 5 do
if t2[i]>max then max:=t2[i];
for i:=1 to 5 do
if t2[i]=max then begin
              ch:=ch ', ' t1[i]   ;
              t2[i]:=-8;
                  end;
delete (ch,1,2);
writeln('Rang ',j,' :',ch);
j:=j 1;
     until (ch='') or (j=5);
     end;


                                         begin
                                         entrer(np,t1,tchoix);
                                         former(t2);
                                         afficher(t2,t1);
                                         end.