Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Arrays of Records

rexxdragonrexxdragon Posts: 2Member
I cannot get the program to continue past If (choice=5), the program stops there and refuses to calculate the other segement. Any advice would be appreciated.


Program program;
Uses Wincrt;
TYPE
Band_Reports=Record
Masquaraders:string;
People:integer;
Cost:integer;
Income_Sum:integer;
End;
Band=Array [1..5]of Band_Reports;
VAR
B:Band;
x,choice:integer;
Begin
B[1].People:=0;
B[2].People:=0;
B[3].People:=0;
B[4].People:=0;
B[5].People:=0;
For x:= 1 to 5 Do
Begin
Write('Enter masquarader name:');
Readln(B[x].Masquaraders);
Writeln('1.Barbados-$160');
Writeln('2.Miami-$220');
Writeln('3.St.Lucia-$280');
Writeln('4.Brazil-$350');
Writeln('5.Trinidad-$425');
Repeat
Write('Enter choice:');
Readln(choice);
Until (choice>=1)AND(choice<=5);
If (choice=1) then
Begin
Writeln('Section: Barbados');
B[1].Cost:=$160;
B[1].People:=B[1].People+1;
End;
If (choice=2) then
Begin
Writeln('Section: Miami');
B[2].Cost:=$220;
B[2].People:=B[2].People+1;
End;
If (choice=3) then
Begin
Writeln('Section: St.Lucia');
B[3].Cost:=$280;
B[3].People:=B[3].People+1;
End;
If (choice=4) then
Begin
Writeln('Section: Brazil');
B[4].Cost:=$350;
B[4].People:=B[4].People+1;
End;
If (choice=5) then
Begin
Writeln('Section: Trinidad');
B[5].Cost:=$425;
B[5].People:=B[5].People+1;
End;
If (B[1].Cost=160) then
Begin
Writeln;
Writeln;
Writeln('Section:Barbados');
Writeln;
Writeln('Name of Masquarader:',B[x].Masquaraders);
Writeln('Number of Maquaraders:',B[1].People);
B[1].Income_Sum:= B[1].People*B[1].Cost;
Writeln('Total income for Barbados=$',B[1].Income_Sum);
End;
End;
readkey
End.

Sign In or Register to comment.