Hi all members.. how are you

Can any one help me to make a C programming project ?

Its an "Air Lines Reservition System"

The project is for our C-programming semester in the university
and its due to 15 - 4 - 2006 . The requirements is as follow:

This C-based program is supposed to computerize all or nearly all daily operations required by any Air Lines Company to accomplish the process of booking and managing its flights and flight-related issues.
In order to accomplish this task, you should follow all requirements and specifications listed below, and the suggested methods (e.g.Menus, Programming structures …) listed to guide you during this duty.
If you don’t follow these methods you must insure that your own methods are fulfilling all the requirements and specifications of the system.
The Main Menu of the system should be as follow:

I. Access Routes’ Information.
II. Access Flights’ Information.
III. Generate Flight-related reports.
IV. Book new flight tickets.


Menu Option I:
There are 3 operations included in Menu option I as follow:
�� Add new Route to the system.
�� Delete an existing Route (Should be done by Route No.).
�� Show all Routes in your system (you are free to display them even on screen or in file).
− We mean by Route, the flights lines between cities or countries
(E.g. Gaza - Amman, Gaza – Cairo …).
− The Route’s Information should be stored for each new one are:
Route_No, Route_Name, and Route_Price.
− You should use a structure named ROUTE to hold this
Information.
− All routes of your system should be saved in a binary file
named ROUTES.bin.
-----------------------------------------------------

Menu Option II:
There are 3 operations included in Menu option IIas follow:
�� Add new flight to a specific Route (this should be done by entering the Route No. first).
�� Delete an existing flight from a specific Route (should be done
by Flight No.).
�� Show all flights in a specific Route (by Route No.).
− The Flight’s Information should be stored for each new one are:
Route_No, Flight_No, Flight_Date, Flight_Time and
Seats_Available.
− Any Route could has more than one Flight.
− No Flight belongs to more than one Route.
− You should use a structure named FLIGHT to hold this Information.
Seats_Available must be 50 for each new flight, and you mustn’t book new tickets on a flight with no Seats_Available!?
Flight_Date should be of a structure type named DATE with the following attributes: D_Year, D_Month and D_Day.
− All flights of your system should be saved in a binary file
named FLIGHTS.bin.
--------------------------------------------------

Menu Option III:
There are 3 operations included in Menu option III as follow:
�� List all passengers of a specific flight. (Should be done by
Flight_No).
�� Delete all passengers those didn’t paid there tickets. (Should be
done by Flight_No also).
�� Query about a flight price, date and time. (Should be done by
Flight_No).
− When you perform the first operation you must list paid
passengers only in a good formatted text file named report.txt
for printing purposes.

− You must list in that file all passengers’ and flight’s information
as explained in the next Menu Option.

--------------------------------------------------

Menu Option IV:
− There is only one operation included in this option which is the
booking operation but it’s the most important and you should
follow the directions listed below:
− Any passenger can’t book on more than one flight a time.
− You should first insure that the desired flight has seats
available for that new passenger(s) (you should perform that
checking by entering the desired Flight No. first and you must
save this flight No to store it with the passenger’s Info.).
− If the desired flight already has seats available you can proceed
with the booking operation, else this flight will be a full booked and you must change that flight.
− The Passenger’s Information should be stored for each new one
are:
Flight_No, P_No, P_ID, P_Fname, P_Lname, P_Age and P_Paid.
− The P_No should be a combination of Flight_No he booked on
and serial number indicating his/her seat number in the
plane!?
− The P_Paid should be of Boolean data type that you should
define first, and it must hold a True (1) value when that
passenger already paid his ticket, a False (0) value otherwise.
− You should use a structure named PASSENGER to hold this
Information.
− You should use an array of structures to add the new
passengers in a specific flight to it first, then saving the whole
array in a binary file named PASSENGER.bin each time.


General Notes:
- Follow the directions listed above for each operation as can as
possible.
- Sub menus for each operation (if there is any), should appear
separately and when the user exits from it, the system should return
to the main menu not exiting the system. (The format of these menus
is up to you).
- You should implement each operation of this system in means of
functions.
- You must handle all files’ operations errors.
- You must separate your code in three files:
I. A header file to hold all structures and functions’ prototypes
should be named project.h.
II. A source file to hold all functions’ definitions should be named
source.c.
III. An interface file to hold the main function only should be
named project.c.
- You should write a comment for each file and function as follow:
The Files:
/*
File name: xxxxxxxxxxxxxxxxxxxxx.c/h
Create by: your name - your ID
Create date: dd/mm/yy
Update date: dd/mm/yy
Description: a paragraph to say the purpose of this file
Functions: list of the functions declared/defined within the file
f(), ff(), …… */
The Functions:
In Header File:
/* myFun prototype
Argument 1: a char represent X
Argument 2: an int represent Y
Argument i: ********************
Return : an int represent */
int myFun(char, int);

Please, help me for this project, Its so important
this is my email: <<email snipped>> if any one can help me

Thanks for all

> and its due to 15 - 4 - 2006
Seems that's not the only thing which has been missed....

LOL !!!! OOps Sorrrry its 15 - 5-2006 :cheesy:


>You may have missed this announcement.

>Hullo which part are you stuck on?

Its first time i entered the forum and i hope i still a friend here because i like programming (but iam begainner) and want to practice programming with outhers but iam nowadays want to make the project before time over :sad: .

So, i will attach my (Add_Delete_Routes.C file) to be sure that iam trying to solve this problem.

NOW ( Can any one tell me what is the error in my code? it display numbers in file as unknown symbols.)

OR (Can any one help me in writting the Menu Option IV ) because i didnt understand how to make it (at least help me with steps)

Attachments
#include<stdio.h>
#include<string.h>

struct ROUTE{
	  
	     int rout_no;
		 char rout_name [20];
		  int rout_price ;
}routen;
   
      
void  add_rout(void){
	 
	    FILE *fptr;
		char temp[30];

		int a=35;
		 
		 fptr=fopen("c:\\airline.bin","a");

		 printf("ENTER NEW ROUT \n");
		 printf("\nENTER THE NAME OF THE ROUT :");
		 gets(temp);

		 strcpy(routen.rout_name,strupr(temp));
		    
		 printf("\nENTER THE NUMBER OF THE ROUT :");
		 scanf("%d",&routen.rout_no);

		 printf("\nENTER THE PRIVE OF THE ROUT :");
		 scanf("%d",&routen.rout_price);

		 fwrite(&routen, sizeof(routen),1, fptr);

		 printf("\n*****RECORD ADDED*****");
		 printf("\n   PRESS ANY KEY TO CONTINUE   ");

    //	getch();


	fclose(fptr);
	fflush(stdin);

	void delete_rout(void){
		  FILE *fptr;

		  int i;

		   printf("           DELETE AN EXISTING ROUT       \n");
            
		   printf("  ENTER THE NO OF THE ROUT TO DELETE :");
		    scanf(%d",&i);
				fptr=fopen("c:\\airline.txt","r");

      
               	
               fseek(fptr,(i-1)*sizeof(struct ROUTE),SEEK_SET);
			   fread(routen,sizeof(struct ROUTE),1,fptr);

			   if(routen.rout_no==0){

				     printf("ROUT %d DOES NOT EXIST.\n",i);
			   }
			     else
				 {
					  fseek(fptr,(i-1)*sizeof(struct ROUTE),SEEK_SET);
					  fwrite(&d_rou,sizeof(struct ROUTE),1,fptr);
					   
					   printf("*****THE ROUT WAS DELETING ****\n");
				 }






}
   
void main(){
	  
	add_rout();
	delete_rout();
}

Since it's smallish, it may be better simply to post the code (using code tags).

#include<stdio.h>
#include<string.h>

struct ROUTE
{
   int rout_no;
   char rout_name [20];
   int rout_price ;
}routen;

void  add_rout(void)
{
   FILE *fptr;
   char temp[30];

   int a=35;

   fptr=fopen("c:\\airline.bin","a");

   printf("ENTER NEW ROUT \n");
   printf("\nENTER THE NAME OF THE ROUT :");
   gets(temp);

   strcpy(routen.rout_name,strupr(temp));

   printf("\nENTER THE NUMBER OF THE ROUT :");
   scanf("%d",&routen.rout_no);

   printf("\nENTER THE PRIVE OF THE ROUT :");
   scanf("%d",&routen.rout_price);

   fwrite(&routen, sizeof(routen),1, fptr);

   printf("\n*****RECORD ADDED*****");
   printf("\n   PRESS ANY KEY TO CONTINUE   ");

    //  getch();

   fclose(fptr);
   fflush(stdin);

   void delete_rout(void)
   {
      FILE *fptr;

      int i;

      printf("           DELETE AN EXISTING ROUT       \n");

      printf("  ENTER THE NO OF THE ROUT TO DELETE :");
      scanf(%d",&i);
            fptr=fopen("c:\\airline.txt","r");

           fseek(fptr,(i-1)*sizeof(struct ROUTE),SEEK_SET);
           fread(routen,sizeof(struct ROUTE),1,fptr);

           if(routen.rout_no==0){

           printf("ROUT %d DOES NOT EXIST.\n",i);
           }
           else{
           fseek(fptr,(i-1)*sizeof(struct ROUTE),SEEK_SET);
           fwrite(&d_rou,sizeof(struct ROUTE),1,fptr);

           printf("*****THE ROUT WAS DELETING ****\n");
           }
           }

           void main(){

           add_rout();
           delete_rout();
           }

I also gave it a quick pass through a beautifier, which will help point out a syntax error. But know that good indentation is to help beginners find bugs. Old timers use tools.

It looks as though you are suffering the trifecta of what not to do when starting out:

gets(temp);
fflush(stdin);
void main()

This is not a good sign.

Here are some FAQs to help bail you out. It is fairly important to know how to do some of these "Week 1" type things before moving on.

FAQ > Explanations of... > Why fflush(stdin) is wrong
FAQ > How do I... (Level 2) > Flush the input buffer
Avoid gets
FAQ > How do I... (Level 1) > Get a line of text from the user/keyboard (C)
FAQ > What's the difference between... > main() / void main() / int main() / int main(void) / int main(int argc, char *argv[])

Edited 3 Years Ago by diafol: fixed formatting

This article has been dead for over six months. Start a new discussion instead.