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 Nikolai Kolev
Expertise
I can answer quetions about dynamic and static structures. I can find errors in programs. I can give you ideas about solving problems.

Experience
I have studied Pascal for 8 years. I'm a professional who is very experienced.

 
   

You are here:  Experts > Computing/Technology > Pascal > Pascal > Turbo pascal v1.5 problem....

Topic: Pascal



Expert: Nikolai Kolev
Date: 2/7/2006
Subject: Turbo pascal v1.5 problem....

Question
    
  
    I have a Pascal problem and I want you to please help me get the correct answer of it. I know that you had help 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
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 .

          Thanks in advance........

Dennis Mejos
Southern Christian Colloge
Student

Answer
Hi,

I can give you some hint how to solve your problem, but I won't send you the code - the purpose is to learn how to program it, not just copy-paste.

You should use 2 dimensional array of boolean values to store the taken and empty places. In the begining init the values in the array to false (all seats are empty). Then ask the user to input an integer for a row and a char for the specific place. For the char you should use case statement to determine the number. After that mark the chosen seat as true (it's taken) and that is it!:)

If you have any other questions please ask.

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.