The greatest mistake you can make in life is to be continually fearing you will make one

Saturday 31 July 2010

Questions on Functions

  1. Difference between pass by value and pass by reference?
  2. Can you write function similar to printf()?
  3. How can called function determine number of arguments that have been passed to it?
  4. What is the purpose of main() function?
  5. What are the advantages of functions?
  6. Define function and built-in function?
  7. Can the sizeof operator used to tell the size of an array passed to a function?
  8. Is it possible to execute a code even after the program exits the main() function?
  9. What is a static function?
  10. Why should I prototype a function?
  11. Is it better to use a function or a macro?
  12. How do you determine whether to use a stream function or a low level function?

Friday 30 July 2010

Airline Reservation System in C


    Description

    Develop a software using C for the case given below.


    Write a program to assign seats on each fligh of the airlines only place ( capacity : 20 seats ). Your program should display the following menu alternatives.

    Please type 1 for business class
    please type 2 for economy class

    If person types 1, the program should assign a seat in business class ( seat 1 to 5). if the person types 2, then it should assign economy class ( seat 6 to 20). Your program then should bring a boarding pass indicating the persons' seat number and whether it is in the business or economy class of the place . use a single-scripted array to represent the seating chart of plane. Initialize all the elements of array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of array to 1 to indicate that seat is no longer available. program should never assign a seat which is already assigned. When the business class in full, your program should ask the person if it is acceptable to be placed in economy class ( and vice versa). if yes, then make the appropriate seat assignment. If no, then print the message " next flight leaves in 3 hours "

    Basic Requirements :
    assign a seat either in the business or economy class.
    display a boarding pass
    display seating chart with indication of assigned or not assigned.
    validation - no seat that has been assigned can be re-assigned
    re-assign seat if the class is full

    You may design the system in any way you feel that meets systems requirements. you may include menus that you feel are relevant to navigate around the system. Eventually there should be an end to the system. Use quit to exit the system.

    You may use structures, arrays, loops, and decision structures in your program. you may include any extra feature eg. sorting the boarding passes by name, which you may feel relevant and that adds value to the system