Dear members,
I am a SE(CSE) student. I m completing a mini-project on BUS RESERVATION SYSTEM. I have ended up on a problem with the password,update and booking section. If the code for the password present in the given code is executed then the rest part of the program starts having problem. I am trying the program using file handling in c++. I have tried with most of the part but just have got these problems.
Please provide me with the necessary guidance and the logic if u can.



Code:
/*MINI PROJECT ON BUS RESERVATION SYSTEM*/

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<string.h>
#include<fstream.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>

class bus
{
int busn,s,fare,i,seat;
char driver[10],arrival[5],depart[5],to[10],date[10],pas_name[20];

fstream x,z;

public:
    void install()
    {
    clrscr();
    z.open("data.txt",ios::app);

    cout<<"\n\n\t\t\t***** BUS RESERVATION SYSTEM *****\n\n";
    cout<<"\t\t\t*******INSTALL*******\n\n";
    for(i=0;i<1;i++)
    {
    cout<<"\n\tSource:Kolhapur";
    cout<<"\n\tEnter bus no: ";
    cin>>busn;
    cout<<"\n\tEnter driver's name: ";
    cin>>driver;
    cout<<"\n\tEnter destination:";
    cin>>to;
    cout<<"\n\tEnter fares:";
    cin>>fare;
    cout<<"\n\tEnter arrival time: ";
    cin>>arrival;
    cout<<"\n\tEnter departure time: ";
    cin>>depart;
    cout<<"\n\tEnter date (dd/mm/yy):";
    cin>>date;
    z<<busn<<"\t"<<driver<<"\t"<<to<<"\t"<<fare<<"\t"<<arrival<<"\t"<<depart<<"\t"<<date<<endl;
    }
    z.close();
    getch();
    }

    void show()
    {
    int ch1;
    clrscr();
    z.open("data.txt",ios::in);
    cout<<"\n\n\t\t\t***** BUS RESERVATION SYSTEM *****\n\n";
    cout<<"\t\t\t\t***** SHOW *****\n\n1.Seatwise reservation details\n";
    cout<<"2.Bus reservation details\n\nEnter choice:";
    cin>>ch1;
    clrscr();

    switch(ch1)
    {
    case 1:
    cout<<"Enter Bus no.:";
    cin>>busn;
    cout<<"Enter seat no.:";
    cin>>seat;
    cout<<"\n\tBus no.:"<<busn;
    cout<<"\n\tDriver's name:"<<driver;
    cout<<"\n\tSeat no.:"<<seat;
    cout<<"\n\tPassenger name:"<<pas_name;
    cout<<"\n\tFrom:Kolhapur"<<"\t\t\t\t"<<"To:"<<to;
    cout<<"\n\tFare:Rs."<<fare;
    cout<<"\n\tDate:"<<date;
    cout<<"\n\tArrival time:"<<arrival<<"\t\t\t\t"<<"Departure time:"<<depart;
    break;

    case 2:
    while(z)
    {
    z>>busn>>driver>>to>>fare>>arrival>>depart>>date;
        if(z.eof()==0)
        {
        cout<<"\nBus no.:"<<busn;
        cout<<"\t\t\tDriver's name:"<<driver;
        cout<<"\nSeat no.:"<<seat;
        cout<<"\t\t\tPassenger name:"<<pas_name;
        cout<<"\nFrom:Kolhapur"<<"\t\t\t"<<"To:"<<to;
        cout<<"\nDate:"<<date;
        cout<<"\nArrival time:"<<arrival<<"\t\t"<<"Departure time:"<<depart;
        cout<<"\n\n********************************************************************************";
        }
    }
/*      for(s=0;s<32;s++)
    {
    }*/
    break;
    }
    z.close();
    getch();
    }

    void enquiry()
    {
    clrscr();
    z.open("data.txt",ios::in);
    cout<<"\n\n\t\t\t***** BUS RESERVATION SYSTEM *****\n\n";
    cout<<"\t\t\t      *****  ENQUIRY  *****\n\n";
    cout<<"\t\t\t\tSource:Kolhapur\n";
    cout<<"\n--------------------------------------------------------------------------------";
    cout<<"Bus no.\t   Dest.        Fare\t Date\t\tArr time\tDept time";
    cout<<"\n--------------------------------------------------------------------------------";

    while(z)
    {
    z>>busn>>driver>>to>>fare>>arrival>>depart>>date;
        if(z.eof()==0)
        {
        cout<<busn<<"\t   "<<to<<"  \t"<<fare<<"\t"<<date<<"\t"<<"  "<<arrival<<"\t\t"<<"  "<<depart<<endl;
        }
    }
    z.close();
    getch();
    }

    void empty()
    {
    for(int i=0;i<8;i++)
    {
        for(int j=0;j<4;j++)
        {
        strcpy(bus[p].seat[i][j]," ");
        }
    }
    }
};

/*void pass()
{
int i=0;
char p[6];
clrscr();

cout<<"\n\n\n\n\n\t\t\tEnter password:";
    for(i=0;i<6;i++)
    {
    p[i]=getch();
    cout<<"*";
    }
    p[i]='\0';

    if(strcmp("smokie",p)==0)
    {
    getch();
    cout<<"\n\n\n\t\t\tPassword correct";
    cout<<"\n\n\t\t\tPress Any To Continue.....";
    getch();
    }
    else
    {
    getch();
    cout<<"\n\n\n\t\t\tIncorrect password";
    getch();
    exit(0);
    }
}*/

void main()
{
clrscr();
bus b;
int w,gd=DETECT,gm,ch;
/*initgraph(&gd,&gm,"c:\\tc\\bgi");
setbkcolor(BLUE);*/

//pass();

do
{
clrscr();
cout<<"\n\n\t\t\t***** BUS RESERVATION SYSTEM *****\n\n\n\t\t\t\t-*-*-*-MENU-*-*-*-\n\n\t\t\t\t1.Install\n\t\t\t\t2.Booking\n\t\t\t\t3.Update\n\t\t\t\t4.Show\n\t\t\t\t5.Cancellation\n\t\t\t\t6.Enquiry\n\t\t\t\t7.Exit\nEnter choice:";
cin>>ch;

switch(ch)
{
    case 1: b.install();
        break;
/*    case 2: b.booking();
        break;
    case 3: b.update();
        break;*/
    case 4: b.show();
        break;
/*    case 5: b.cancel();
        break;*/
    case 6: b.enquiry();
        break;
    case 7: exit(0);
}
}while(ch!=7);
getch();
}