![]() |
| ||
| error 88:'(' expected when trying to display an array any help i have designed a database an one of my feilds is set up as an array. i had no problems reading my data into the array but i am having trouble trying to display the feild. when compiling the following error occurs. error 88 expected (. the error occurs in the section where the text color has been changed below are the sections that i think are relevant to the problem: program ordering; uses crt; type ordertype = array[1..8] of string[25]; order = record memberid:string[10]; orderref:string[10]; address1:string[20]; noveg:integer; nononveg:integer; orderdate:string[10]; orderdetail : ordertype ; pricepp:real; totalprice:real; discount:string[3]; finalprice:real; end; intfiletype1 = file of order; extfilenametype1 = string [25]; procedure enterrecdata1 (var memrecord : order); var i:integer; hold: ordertype; begin writeln; with memrecord do begin writeln ('Enter Member ID: '); write ('Press the enter key to end input:'); readln (memberid); if memberid <> '' then begin write ('Enter Order Ref: '); readln (orderref); write ('Enter number of veggie people: '); readln (noveg); write ('Enter number of non veg: '); readln (nononveg); write ('Enter date of order: '); readln (orderdate); write ('Enter order: '); for i:= 1 to 8 do readln (orderdetail[I]); write ('Enter price per person: '); readln (pricepp); totalprice:=((nononveg) + (noveg)) * (pricepp) ; writeln ('Discount?: '); write ('*If yes type Y If no type N*'); readln (discount); if discount = 'n' then (finalprice) := (totalprice) else finalprice := totalprice * 0.90 end end end; procedure display1; var memrecord : order; intfile : intfiletype1; masterfile : extfilenametype1; x:integer; begin clrscr; gotoXY (15,1); writeln ('-----MEMBERS FILE-----'); gotoXY (10,3); getmasterfilename1 (masterfile); gotoXY (1,5); assign (intfile, masterfile); reset (intfile); while not eof (intfile) do begin read (intfile, memrecord); with memrecord do begin x:=0; repeat clrscr; writeln ('Member ID: ',memberid); writeln ('Order REF: ',orderref); writeln('Number of veg People: ' ,noveg); writeln('Number of Non veg people: ' ,nononveg); writeln ('Date of order: ',orderdate); writeln ('Order: ',ordertype[i]); writeln('Price per Person:œ',pricepp:8:2); writeln('Total Price:œ',totalprice:8:2); writeln('Discount?: ',discount); writeln('Final Price: œ',finalprice:8:2); x:=x+1 until (x=8) or (eof(intfile)); readln; end end; please help!! thank you |
| ||
| Re: error 88:'(' expected when trying to display an array any help what is 'i' in that procedure? It's undefined... |
| ||
| Re: error 88:'(' expected when trying to display an array any help i have now defined 'i' as an integer as it is above in procedure enterrecdata1 but still the same error occurs. any more ideas thanks for the help jwenting |
| ||
| Re: error 88:'(' expected when trying to display an array any help i have solved the problem the following code is correct. the highlighted section is the changed part. procedure display1; var memrecord : order; intfile : intfiletype1; masterfile : extfilenametype1; x:integer; begin clrscr; gotoXY (15,1); writeln ('-----MEMBERS FILE-----'); gotoXY (10,3); getmasterfilename1 (masterfile); gotoXY (1,5); assign (intfile, masterfile); reset (intfile); while not eof (intfile) do begin read (intfile, memrecord); with memrecord do begin x:=0; repeat clrscr; writeln ('Member ID: ',memberid); writeln ('Order REF: ',orderref); writeln('Number of veg People: ' ,noveg); writeln('Number of Non veg people: ' ,nononveg); writeln ('Date of order: ',orderdate); for i := 1 to 8 do writeln ('Order: ',orderdetail[i]);writeln('Price per Person:œ',pricepp:8:2); writeln('Total Price:œ',totalprice:8:2); writeln('Discount?: ',discount); writeln('Final Price: œ',finalprice:8:2); x:=x+1 until (x=8) or (eof(intfile)); readln; end end; |
| All times are GMT -4. The time now is 4:57 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC