Illegal Expression's Pascal (New Errors) -
program paidup; const size=30; var payment,totm1,totm2,totm3:real; section1,section2,section3,i,j,idnum:integer; idnumarr:array[1..999] of integer; paymentarr:array[1..size] of real; procedure initialisevariables; {this procedure initialises variables used in program} begin idnum:=0; payment:=0; totm1:=0; totm2:=0; totm3:=0; section1:=0; section2:=0; section3:=0; i:=0; j:=0; end; {initialise variables} procedure declareandinitialisearrays; {this procedure declares , initialises arrays used in program} begin i:=1 size begin idnumarr[i]:=0; paymentarr[i]:=0; end; {ends statment} end; {declare , initialise variables} procedure putdataintoarray; {this procedure puts data arrays} begin while(idnum<>0) , (payment<>0) , (payment=1350) , (payment=1620) , (payment=1800) , (payment=1650) , (payment=1980) , (payment=2200) begin writeln('invalid value, please enter value'); readln(idnum); readln(payment); end;{ends while statement} j:=j+1; idnumarr[j]:=idnum; paymentarr[j]:=payment; end; {put data array} procedure determinestatisticsinformation; {this procedure determines masqueraders belong group, tallys total persons in section , totals amount of money paid in each section costumes} begin j:=1 size begin if(paymentarr[j]=1350) , (paymentarr[j]=1650) begin writeln('masquerader memid:idnum[j] belongs section1'); section1:= section1+1; totm1:= totm1+paymentarr[j]; end;{ends if statement} if(paymentarr[j]=1620) , (paymentarr[j]=1980) begin writeln('masquerader memid:idnum[j] belongs section2'); section2:= section2+1; totm2:=totm2+paymentarr[j]; end;{ends if statement} if(paymentarr[j]=1800) , (paymentarr[j]=2200)then begin writeln('masquerader memid:idnum[j] belongs section3'); section3:= section3+1; totm3:=totm3+paymentarr[j]; end;{ends if statement} end; {determine statistics information} procedure printresults; {this procedure outputs information} begin writeln('the number of masqueraders in section 1 is:', section1); writeln('the number of masqueraders in section 2 is:', section2); writeln('the number of masqueraders in section 3 is:', section3); writeln('total amount of money paid in section 1 is:', totm1); writeln('total amount of money paid in section 2 is:', totm2); writeln('total amount of money paid in section 3 is:', totm3); end. {print results} the errors got were: 77 / 11 paidup.pas error: illegal expression 77 / 11 paidup.pas error: illegal expression 77 / 11 paidup.pas fatal: syntax error, ; expected identifier printresults found
you still missing end statement match begin statement follows for j:=1 size do in procedure determinestatisticsinformation.
also, while condition while(idnum<>0) , (payment<>0) , (payment=1350) , (payment=1620) , (payment=1800) , (payment=1650) , (payment=1980) , (payment=2200) do in procedure putdataintoarray never true impossible payment simultaneously equal 1350 , equal 1620 etc...
Comments
Post a Comment