hey,
i got a c project to be done n that is about

a flight reservation system
so i want help from u to do my codings.....
i plan to create two file pointers and make 2 txt files namely
Flight details
and reservation details
plz send me some Turbo c++ codings to work it,
in reservation details what im gonna add is nessasary.....
how to create columns in the screen ............
so plz help me i will give some more details abt this
just send me how i have to make it in details ,
with some codings to do that

Comments
Another lame illiterati looking for free homework

Air line Reservation and Flight details system

#include<stdio.h>
#include<conio.h>
# include<stdlib.h>

void WelcomeScreen()
{

    int KeyCode,count=0;

    do
    {
        clrscr();
        gotoxy(15,5);
        printf("~~~~~~~~~~~~~ Welcome to Mihin Lanka ~~~~~~~~~~~~~");
        gotoxy(27,15);
        printf("Aviation Key Code Wanted : ");
        scanf ("%i",&KeyCode);

        if(KeyCode==602)
        {
            gotoxy(25,21);
            printf("********** YOU CAN PROCEED **********");
            break;
        }
        else
        {
            count++;

            gotoxy(23,25);
            printf("***********FORGOT KEY CODE***********");
            printf("\n\n\n***********TRY AGAIN**********");
            break;
            getch();
            if(count>2)
                exit(1);
        }

    }while(count<3);

}

void frame()
{
    int index;
    clrscr();
    for(index=1;index<=79;index++)
    {
        gotoxy(index,1);
        printf("~");
        gotoxy(index,3);
        printf("~");
        gotoxy(index,25);
        printf("~");
    }
    for(index=1;index<=24;index++)
    {
        gotoxy(1,index);
        printf("*");
        gotoxy(80,index);
        printf("*");
    }
    gotoxy(1,2);
    printf("~~~");
    gotoxy(28,2);
    printf("MIHIN LANKA AVIATION CENTER");
    printf("\n........................");
    gotoxy(78,2);
    printf("~~~");
}

void MainMenu()
{
    do
    {
        clrscr();
        frame();
        gotoxy(33,6);
        printf("AirLINE RESEVATIN MAIN MENU");
        gotoxy(33,7);
        printf("~~~~~~~~~~~~~~~~~");
        gotoxy(30,10);
        printf("[1] Reservation");
        gotoxy(30,12);
        printf("[2] Booking a Seat");
        gotoxy(30,14);
        printf("[3] Flight List");
        gotoxy(30,16);
        printf("[4] Exit");
        gotoxy(30,20);
        printf("Select your option : ");
        scanf ("%i",&option);

        switch(option)
        {
            case 1 :  Reservation();
                  break;
            case 2 :  Booking a Seat();
                  break;
            case 3 :      Flight List();
                  break;
            case 4 :   Exit();
                  gotoxy(30,15);
                  printf("Thank You, Good Bye");
                  break;
            default:  clrscr();
  printf("You have selected an invalid number");
                  printf("Pleae select again");
                  getch();
                  option=0;
        }
    }while(option==0);
}

void main()
{
clrscr();
WelcomeScreen();
frame();
getch();
}

above is a part f my codings, im really sorry that day,i was really mixed up, but the MainMenu part is not work..plz correct it an send me ...... i will send the other codings part by part...
if u can also give me the infromations how to change the colours f text(what are the codings for that),and how to take the mouse pointer to the screen,send me some little examples of that..
thank u so much....for encouraging me that day

# include<stdio.h>
  # include<conio.h>
  # include<stdlib.h>
   
  //definition of files used
  # define Reservation"c:\\book.txt"
  # define TEMPFILE "c:\\tempfile.txt"
   
  //definition of Functions prototype
  void WelcomeScreen(void);
  void frame(void);
  void MainMenu(void);
  void Reservation(void);
  void ADD (void);
  void EditBook(void);
  void SearchBook(void);
  void DeleteBook(void);
  void Booking a seat(void);
  void Flight list(void);
   
  //definition of File pointers
  FILE *fileptr;
  FILE *fptrt;
   
  //definition of global variables
  int option,found=0,book_code,coppies;
  char res,name[20],catagory[20],author[20];
  float price;
   
  //main function
  void main(void)
  {
              clrscr();
              WelcomeScreen();
              MainMenu();
              getch();
  }
   
  void WelcomeScreen(void)
  {
              int password,count=0;
   
              do
              {
                          clrscr();
                          frame();
                          gotoxy(25,8);
                          printf("!!! Welcome to Sigma Institute !!!");
                          gotoxy(27,15);
                          printf("Please enter the password : ");
                          scanf ("%i",&password);
   
                          if(password==123)
                          {
                                      gotoxy(30,18);printf("!!! Access accepted !!!");
                                      break;
                          }
                          else
                          {
                                      count++;
                                      gotoxy(30,18);printf("!!! Access denied !!!");
                                      getch();
                                      if(count>2)
                                                  exit(1);
                          }
              }while(count<3);
  }
  //function for screen frame
  void frame(void)
  {
              int index;
              clrscr();
              for(index=1;index<=79;index++)
              {
                          gotoxy(index,1);printf("*");
                          gotoxy(index,3);printf("*");
                          gotoxy(index,25);printf("*");
              }
              for(index=1;index<=24;index++)
              {
                          gotoxy(1,index);printf("*");
                          gotoxy(80,index);printf("*");
              }
              gotoxy(1,2);printf("***");
              gotoxy(33,2);printf("SIGMA INSTITUTE");
              gotoxy(78,2);printf("***");
  }
   
  //declaration of mainmenu
  void MainMenu(void)
  {
              do
              {
                          clrscr();
                          frame();
                          gotoxy(33,6);
                          printf("AirLINE RESEVATIN MAIN MENU");
                          gotoxy(33,7);
                          printf("~~~~~~~~~~~~~~~~~");
                          gotoxy(30,10);
                          printf("[1] RESERVATION");
                          gotoxy(30,12);
                          printf("[2] Book ING A SEAT");
                          gotoxy(30,14);
                          printf("[3] FLIGHT LIST");
                          gotoxy(30,16);
                          printf("[4] Exit");
                          gotoxy(30,20);
                          printf("Select your option : ");
                          scanf ("%i",&option);
   
                          //calling of functions
                          switch(option)
                          {
                                      case 1 :  BookMaintenance();
                                                    break;
                                      case 2 :  Receipt();
                                                    break;
                                      case 3 :   Report();
                                                    break;
                                      case 4 :   clrscr();
                                                    frame();
                                                    gotoxy(30,15);
                                                    printf("Thank You, Good Bye");
                                                    break;
                                      default:  clrscr();
    printf("You have selected an invalid number");
                                                    printf("Pleae select again");
                                                    getch();
                                                    option=0;
                          }
              }while(option==0);
  }
   
  //function for book maintenance menu
  void BookMaintenance(void)
  {
              do
              {
                          clrscr();
                          frame();
                          gotoxy(31,6);
                          printf("Book Maintenance Menu");
                          gotoxy(31,7);
                          printf("~~~~~~~~~~~~~~~~~~~~~");
                          gotoxy(33,10);
                          printf("[1] Booking a seat");
                          gotoxy(33,12);
                          printf("[2] Add records");
                          gotoxy(33,14);
                          printf("[3] Edit records");
                          gotoxy(33,16);
                          printf("[4] Cancel ");
                          gotoxy(33,18);
                          printf("[5] Search books");
                          gotoxy(33,20);
                          printf("[6] Exit");
                          gotoxy(33,22);
                          printf("Select your option : ");
                          scanf ("%i",&option);
   
                          //calling of sub-functions
                          switch(option)
                          {
                                      case 1 :  AddBook();
                                                   break;
                                      case 2 : EditBook();
                                                   break;
                                      case 3 :  DeleteBook();
                                                   break;
                                      case 4 : SearchBook();
                                                   break;
                                      case 5 :  MainMenu();
                                                   break;
                                      default: clrscr();
   printf("You have selected an invalid number");
                                                   printf("Pleae select again");
                                                   getch();
                                                   option=0;
                          }
              }while(option==0);
  }
  //function to addbooking a seat intoairline reservation
  void AddBook(void)
  {
              fileptr=fopen(BOOKFILE,"a+");
              do
              {
                          clrscr();
                          frame();
                          gotoxy(33,6);
                          printf("Add Records");
                          gotoxy(33,7);
                          printf("~~~~~~~~~~~");
                          gotoxy(30,10);
                          printf("Book_Code       : ");
                          scanf ("%i",&book_code);
                          gotoxy(30,12);
                          printf("Name                 : ");
                          scanf ("%s",name);
                          gotoxy(30,14);
                          printf("Catagory            : ");
                          scanf ("%s",catagory);
                          gotoxy(30,16);
                          printf("Author               : ");
                          scanf ("%s",author);
                          gotoxy(30,18);
                          printf("Coppies             : ");
                          scanf ("%i",&coppies);
                          gotoxy(30,20);
                          printf("Price                  : ");
                          scanf ("%f",&price);
   
  fprintf(fileptr,"%i %s %s %s %i   %f\n",book_code,name,catagory,author,coppies,price);
   
                          gotoxy(30,22);
                          printf("Your record has been added!!");
                          gotoxy(30,23);
                          printf("Do you want to add more records(y/n):");
                          fflush(stdin);
                          scanf ("%c",&res);
              }
              while(res=='y');
              BookMaintenance();
              fclose(fileptr);
  }
   
  //function to edit bookrecords
  void EditBook(void)
  {
              int ecode;
              do
              {
                          clrscr();
                          frame();
                          gotoxy(35,5);
                          printf("Edit Records");
                          gotoxy(35,6);
                          printf("~~~~~~~~~~~~");
   
                          fileptr=fopen(BOOKFILE,"r+");
                          fptrt=fopen(TEMPFILE,"w+");
   
                          gotoxy(30,8);
                          printf("Enter code to edit:");
                          gotoxy(50,8);
                          scanf ("%i",&ecode);
                          while(!feof(fileptr))
                          {
  fscanf(fileptr,"%i %s %s %s %i %f",&book_code,name,catagory,author,&coppies,&price);
                                      
  if(feof(fileptr))
                                                  break;
                                      if(ecode!=book_code)
  fprintf(fileptr,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                                      else
                                      {
                                                  gotoxy(30,10);
                                                  printf("Code is found");
                                                  gotoxy(30,12);
                                      printf("Name      : ");
                                                  scanf ("%s",name);
                                                  gotoxy(30,14);
                                                  printf("Catagory            : ");
                                      scanf ("%s",catagory);
                                                  gotoxy(30,16);
                                                  printf("Author               : ");
                                                  scanf ("%s",author);
                                      gotoxy(30,18);
                                                  printf("Coppies             : ");
                                                  scanf ("%i",&coppies);
                                                  gotoxy(30,20);
                                                  printf("Price                  : ");
                                                  scanf ("%f",&price);
   
  fprintf(fptrt,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                                      }
                          }
                          fclose(fileptr);
                          fclose(fptrt);
                          remove(BOOKFILE);
                          rename(TEMPFILE,BOOKFILE);
                          gotoxy(30,23);
                          printf("Do you want to continue : ");
                          fflush(stdin);
                          gotoxy(60,23);
                          scanf ("%c",&res);
              }while(res=='y');
              BookMaintenance();
  }
   
  //function to search in bookrecords
  void SearchBook(void)
  {
              int scode;
              found=0;
              do
              {
                          clrscr();
                          frame();
                          gotoxy(33,5);
                          printf("Search Records");
                          gotoxy(33,6);
                          printf("~~~~~~~~~~~~~~");
   
                          fileptr=fopen(BOOKFILE,"r+");
                          fptrt=fopen(TEMPFILE,"w+");
   
                          gotoxy(30,8);
                          printf("Enter code to edit:");
                          gotoxy(50,8);
                          fflush(stdin);
                          scanf ("%i",&scode);
                          while(!feof(fileptr))
                          {
  fscanf(fileptr,"%i %s %s %s %i %f",&book_code,name,catagory,author,&coppies,&price);
                                      if(feof(fileptr))
                                                  break;
                                      if(scode!=book_code)
  fprintf(fptrt,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                                      else
                                      {
                                                  found=1;
                                                  gotoxy(30,10);
                                                  printf("Code is found");
                                                  gotoxy(30,12);
  printf("%i %s %s %s %i %.2f\n",book_code,name,catagory,author,coppies,price);
  fprintf(fptrt,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                                      }
                          }
                          if(found==0)
                          {
                                      gotoxy(30,14);printf("\nCode not found");
                          }
                          gotoxy(30,16);
                          printf("\nDo u want to continue: ");
                          gotoxy(30,40);
                          fflush(stdin);
                          scanf ("%c",&res);
                          fclose(fileptr);
                          fclose(fptrt);
                          remove(BOOKFILE);
                          rename(TEMPFILE,BOOKFILE);
              }while(res=='y');
              BookMaintenance();
  }
   
  //function to delete bookrecords
  void DeleteBook(void)
  {
              int dcode;
              found=0;
              do
              {
              fileptr=fopen(BOOKFILE,"r+");
              fptrt=fopen(TEMPFILE,"w+");
   
              clrscr();
              printf("Enter code to delete:");
              fflush(stdin);
              scanf ("%i",&dcode);
              while(!feof(fileptr))
              {
  fscanf(fileptr,"%i %s %s %s %i %f",&book_code,name,catagory,author,&coppies,&price);
                          if(feof(fileptr))
                                      break;
                          if(dcode!=book_code)
  fprintf(fptrt,"%i %s %s %s %i %f",book_code,name,catagory,author,coppies,price);
                          else
                          {
                                      found=1;
                                      printf("\nCode is found and deleted");
  printf("\n%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                          }
              }
                          if(found==0)
                                      printf("\nCode not found");
                          printf("\nDo u want to continue: ");
                          fflush(stdin);
                          scanf ("%c",&res);
              fclose(fileptr);
              fclose(fptrt);
              remove(BOOKFILE);
              rename(TEMPFILE,BOOKFILE);
              }while(res=='y');
              BookMaintenance();
  }
   
  //function to print lending receipt
  void Receipt (void)
  {
              int icode,quantity,count=0;
              char stname[20];
              found=0;
   
              clrscr();
              frame();
              gotoxy(5,5);
              printf("Enter Student Name : ");
              gotoxy(35,5);
              scanf ("%s",stname);
              do
              {
                          fileptr=fopen(BOOKFILE,"r+");
                          fptrt=fopen(TEMPFILE,"w+");
   
                          gotoxy(5,7);
                          printf("Enter book code :");
                          gotoxy(35,7);
                          fflush(stdin);
                          scanf("%i",&icode);
                          while(!feof(fileptr))
                          {
                                       //read from the file
  fscanf(fileptr,"%i %s %s %s %i %f",&book_code,name,catagory,author,&coppies,&price);
                                       if(feof(fileptr))
                                                              break;
                                      //compare two numbers
                                       if(icode!=book_code)
  fprintf(fptrt,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                                       else
                                       {
                                                  found=1;
                                                  gotoxy(20,10);
                                                  printf("Book Lending Receipt");
                                                  gotoxy(20,11);
                                                  printf("--------------------");
                                                  gotoxy(5,13);
                                                  printf("Book_Code          Description        No of Coppies");
                                                  gotoxy(5,14);
                                                  printf("---------           ------------       -------------");
                                                  gotoxy(5,(16+count));
                                                  printf("%i",book_code);
                                                  gotoxy(30,(16+count));
                                                  printf("%s",name);
                                                  gotoxy(45,(16+count));
                                                  // check=1;
                                                  fflush(stdin);
                                                  scanf("%i",&quantity);
   
                                                  while(quantity>coppies)
                                                  {
                                                  // check=0;
                                                              gotoxy(5,23);
  printf("Quentity is greater than the number of coppies");
                                                              gotoxy(45,20);
                                                              scanf("%i",&quantity);
                                                  }
                                                              coppies=coppies-quantity;
  fprintf(fptrt,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
                                                  }
                                      }
                          if(found==0)
                          {
                                      gotoxy(5,18);
                                      printf("\t\t\t Record is not in the file ");
                                      getch();
                                      MainMenu();
                          }
              fclose(fileptr);
              fclose(fptrt);
  //erase the old file
  remove(BOOKFILE);
  //rename the temp file
  rename(TEMPFILE,BOOKFILE);
              gotoxy(5,20);
   
              if(found==1)
              {
                          printf("Do you wanna continue : ");
                          fflush(stdin);
                          scanf("%c",&res);
                          gotoxy(5,18);
                          printf("                          ");
                                      count =count+1;
                          gotoxy(5,22);
                          printf("Do you want to print: ");
                          fflush(stdin);
                          scanf("%c",&res);
              }
              }while(res=='y' && count<3);
   
              MainMenu();
  }
   
  //function to show bookavailability report
  void Report(void)
  {
              clrscr();
              frame();
              int count=0;
   
              fileptr=fopen(BOOKFILE,"r+");
              fptrt=fopen(TEMPFILE,"w+");
              while(!feof(fileptr))
              {
                           //read from the file
   fscanf(fileptr,"%i %s %s %s %i %f",&book_code,name,catagory,author,&coppies,&price);
                           if(feof(fileptr))
                                      break;
                          gotoxy(30,5);
                          printf("Book Availability Report");
                          gotoxy(30,6);
                          printf("------------------------");
                          gotoxy(10,8);
                          printf("Book_Code           description        No of coppies ");
                          gotoxy(10,9);
                          printf("---------           ------------       --------------");
                          gotoxy(10,(11+count));
                          printf("%i",book_code);
                          gotoxy(35,(11+count));
                          printf("%s",name);
                          gotoxy(50,(11+count));
                          printf("%i",coppies);
                          count =count+1;
  fprintf(fptrt,"%i %s %s %s %i %f\n",book_code,name,catagory,author,coppies,price);
              }
              fclose(fileptr);
              fclose(fptrt);
              //erase the old file
              remove(BOOKFILE);
              //rename the temp file
              rename(TEMPFILE,BOOKFILE);
   
              getch();
              MainMenu();
  }

i tried my above codings to run in TurboC++ 4.5 version, but its not working properly

plz help me and tell what are the parts to be corrected and plz send me the right and workable codings for them....
thank u for helping me..

>>but its not working properly
what doesn't it do that you want it to? Not everyone has your compiler so you need to explain what it does wrong. Compile errors? executation errors?

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