AllExperts > Experts 
Search      

Pascal

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Pascal Answers
Question Library

Ask a question about Pascal
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
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%
 
   

You are here:  Experts > Computing/Technology > Pascal > Pascal > Turbo pascal question.

Topic: Pascal



Expert: Francis Kong
Date: 2/10/2006
Subject: Turbo pascal question.

Question
    
     I would like to ask for help to you whose aim is to help someone most specially students to solve their problem in Turbo Pascal programs.
    I have a Pascal problem and I want you to please help me get the correct answer of it. For I know that you helps all who got some Pascal problems because you have a great knowledge on it. My problem is stated below:

    Write a program to assign passenger seats in an airplane. Then lets the user to choose a seat or seats he desired. And just assume a small airplane with seats numbered as follows:
1  A  B  C  D
2  A  B  C  D
3  A  B  C  D
4  A  B  C  D
5  A  B  C  D
6  A  B  C  D
7  A  B  C  D

    After the user enter his choosen seat(s) the program should display the seat pattern, marking with an '' X '' the seats 1A , 2B, 3C and 4D are taken, the display  should look like this:

1  X  B  C  D
2  A  X  C  D
3  A  B  X  D
4  A  B  C  X
5  A  B  C  D
6  A  B  C  D
7  A  B  C  D

    I hope that you could send me a response with the pascal code I needed. I'll treasure your kindness  and cherish it .

    Note:
    This is not a homework. I just want to know how to used array type and I'll make the code of this program my guide in this topic.
    Pleasegive me the code of it.
    Please.......

          Thanks in advance........

Dennis Mejos
Southern Christian Colloge
Student

Answer
ok, this is how to declare the thing:

type seats = array [1..7,1..4] of boolean;

var seatlist: seats;

then at the beginning of the program:

for i:= 1 to 7 do
 for j:= 1 to 4 do
   seatlist[i,j] = false;

then to assign a seat at 7th row, column d, say,

seatlist[7,4] := true;

to display:

for each row:

{write down row number}
if seatlist[{row number},1] then
write('X ')
else write('A ');
if seatlist[{row number},2] then
write('X ')
else write('B ');
if seatlist[{row number},3] then
write('X ')
else write('C ');
if seatlist[{row number},4] then
write('X ')
else write('D ');

writeln;

you should then get the idea

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.