About Francis Kong Expertise Pascal programming. I would be best at solving logic and syntax errors with some given code, or some programming theory and specific task. I have done mostly my pascal within a machine(meaning, not networking and serial cable yet)and I am not able to solve things in ObjectWindows... I should be able to answer most of the thing done in console(dos and x systems like linux) platform and in Mac(but for Mac I can only handle nonplatform-specific questions). Feel free to ask me, because if I am not able to answer it I might be able to tell where to get the specific material that you need
Experience teached a classmate with an exam mark of 56% and the second shot with a higher difficulty the tutee gets more than 80%
Expert: Francis Kong Date: 3/15/2006 Subject: Turbo PAscal problem
Question Your'e right, but I want you to see this program. Here it it: And pls correct it if you can find something wrong. Pls uide me. Here it is:
Program PlaneSeats;
uses wincrt;{pascal for windows}
type seat = array[1..7,'A'..'D'] of boolean;
var B : seat;
I : integer;
J : char;
Procedure ShowSeats;
var I : integer;
J : char;
begin
For I := 1 to 7 do
write(I:1);
For J := 'A' to 'D' do
write(J:3);
writeln;
B[I,J]:=false;
B[7,4]:=true;
end;
begin
ShowSeats;
writeln('User's input');
read(I);{I use this two but dont work pls sugggest on what to put here.}
read(J);{Also this}
Up to this part only I can do. Pls help me. Again Thank You.
Program
-------------------------
Followup To
Question -
I have ask you last time about passenger seaets and I already have an idea of it. But first I want to thank you, your'e a kindhearted person. but here's anothe problem, I use in the read(B[I,J}) but it does not work. For you how should I read the users choice.
Answer -
here are some suggestions without knowing how it doesn't work:
have a variable called x and Y (the location of the seats);
have the following lines as input:
read(x);
read(y);
If I recall correctly I mention to you the seats are in boolean,
you then will have
B[x,y] = true; {or false depend on the initial value; if you put them initially as true then put it to false}
(I have no idea what the exact error is, maybe if you mention it I might have more accurate suggestions for you)
Answer for a procedure to show the seats, use this:
Procedure ShowSeats;
var I : integer;
J : char;
begin
clrscr;
writeln(' A B C D');
For I := 1 to 7 do
begin
write(I,' ');
For J := 'A' to 'D' do
begin
if B[i,j] then
write(' O')
else
write(' X');
end;
writeln;
end;
end;
then your program should look like:
Program Planeseats;
uses wincrt;
type seat = array[1..7,'A'..'D'] of boolean;
var B : seat;
x:integer;
y: char;
{insert the procedure showseats here}
begin
for x := 1 to 7 do
for y := 'A' to 'D' do
B[x,y] := true;
{the following is a brief demonstration of how it works; please change accordingly}
showseats;
read(x);
read(y);
B[x,y] := false;
showseats;
readln;
end.