Pascal

Moderators: None (Apply to moderate this forum)
Number of posts: 14016

This Forum Only

Arrays of Records Posted by rexxdragon on 14 Jun 2012 at 7:13 PM
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
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
Writeln('2.Miami-\$220');
Writeln('3.St.Lucia-\$280');
Writeln('4.Brazil-\$350');
Repeat
Write('Enter choice:');
Until (choice>=1)AND(choice<=5);
If (choice=1) then
Begin
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
B[5].Cost:=\$425;
B[5].People:=B[5].People+1;
End;
If (B[1].Cost=160) then
Begin
Writeln;
Writeln;
Writeln;
B[1].Income_Sum:= B[1].People*B[1].Cost;
End;
End;
End.

rexxdragon Arrays of Records on 14 Jun 2012 at 7:13 PM

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic