You are on page 1of 25

//===========================================================================

//
//

//

RAILWAY SMART CARD MANAGEMENT SYSTEM

//

//
//===========================================================================
//===========================================================================
//
// => LIST OF ALL HEADER FILES
//
//===========================================================================
#include <dos.h>
#include <fstream.h>
#include <process.h>
#include <stdio.h>
#include <iostream.h>
#include <time.h>
#include <conio.h>
#include <process.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iomanip.h>
#include <timer.h>
#include<graphics.h>
#define MAX 1000
//===========================================================================
//
// => LIST OF ALL FUNCTION PROTOTYPES
//
//===========================================================================
int ticketcharge(int );
void header();
void login_star(char *);
void timerlogo();
void readstation();
void writestation();
void start();
void ustart(int);
void smartprocess();
void get();
void updatedatabase();
void stationmodification();
void customermodification();

//===========================================================================
//
// =>
CLASS: CUSTOMER
// => OBJECTIVE: contains attributes of the customer like customer name,bal e
tc..
//

//===========================================================================
class customer
{
public:
char name[20];
char city[20];
long int pincode;
char id[20];
char pwd[20] ;
long int balance;
} ;

class train
{
public:
int train_no;
char train_name;
get_traindata();
};

//===========================================================================
//
// =>
CLASS: station
// => OBJECTIVE: contains station details .
//
//===========================================================================
class station
{
public:
int station_no;
char station_name[80];
void getstation()
{
clrscr();
header();
cout << "\n\n\t********* STATION REGISTER FORUM ***********";
cout <<"\n\n\n\tENTER STATION NO(I): ";
cin>> station_no;
cout<<endl;
cout <<"\n\tENTER STATION NAME(C): ";
cin>> station_name;
cout << endl;
cout<<"\n\tSTATION DETAILS SUCCESSFULLY ADDED!!!" ;
getch();
}
};
//===========================================================================
//
// =>
CLASS: ticket
// => OBJECTIVE: contains ticket details of the current user.

//
//===========================================================================
class ticket
{
public:
int ticket_sno;
int no_of_ticket;
int no_of_station ;
int tcharge;
char date[10];
};
//===========================================================================
//
// =>
CLASS: smart application
// => OBJECTIVE: it is a main derived class.it inherit the
//
base class of customer,train ,ticket (multiple inheritance)
//
//===========================================================================
class smart_application :public customer,public train,public ticket
{
public:
void get_custdata()
{
clrscr();
header();
cout<<"\n\t CUSTOMER REGISTER FORUM \n";
cout <<"\n\tCUSTOMER NAME(C): ";
cin >>name;
cout <<"\n\tCUSTOMER CITY(C): ";
cin >> city;
cout <<"\n\tCUSTOMER PINCODE(I): ";
cin>> pincode;
cout <<"\n\tCUSTOMER ID(C): ";
cin >> id ;
cout <<"\n\tCUSTOMER PWD(C): ";
cin>> pwd;
cout <<"\n\tCUSTOMER BALANCE(I): ";
cin>> balance;
cout<<"\n\n\t CUSTOMER DETAILS ADDED SUCCESSFULLY!!!!";
getch();
}
void printcustomer()
{
clrscr();
header();
cout<<"\n\n\t CUSTOMER DETAILS ";
cout <<"\n\n\tNAME: ";
cout << name;
cout <<"\n\n\tCITY: ";
cout << city;
cout <<"\n\n\tPINCODE: ";
cout << pincode;
cout <<"\n\n\tID: ";

cout
cout
cout
cout
cout

<< id ;
<<"\n\n\tPWD: ";
<< pwd;
<<"\n\n\tBALANCE: ";
<< balance;

cout <<"\n\n\tENTER TO CONTINUE....";


}
compute_ticket();
};
smart_application *s= new smart_application[MAX];
station *o= new station [MAX];
int st,u;
//===========================================================================
//
// => file management for read station and write station
//
//===========================================================================
int filesize(char fname[],int lpc)
{ FILE *fp;
int n=0;
char ch;
fp=fopen(fname,"r");
do
{
/* read a char from the file */
ch = fgetc(fp);
/* count the lines */
if(ch=='\n')
n++;
} while (ch != EOF);
n/=lpc;
return n;
}
void readstn()
{
ifstream in;
in.open ("st.txt");
in>>st;
for(int i=1;i<=st;i++)
{
in>>o[i].station_no;
in>>o[i].station_name;
}
in.close();
}
void writestn()
{
ofstream out;

out.open ("st.txt",ios::end);
out<<st<<endl;
for(int i=1;i<=st;i++)
{
out<<o[i].station_no<<endl;
out<<o[i].station_name<<endl;
}
out.close();
}

void readcust()
{
ifstream in;
in.open("cust.txt");
in>>u;
for (int i=1;i<=u;i++)
{
in>>s[i].name;
in>>s[i].city;
in>>s[i].pincode;
in>>s[i].id;
in>>s[i].pwd;
in>>s[i].balance;
}
in.close();
}
void writecust()
{
ofstream out;
out.open ("cust.txt",ios::end);
out<<u<<endl;
for
{
out
out
out
out
out
out

(int i=1;i<=u;i++)
<<s[i].name<<endl;
<< s[i].city<<endl;
<<s[i].pincode<<endl;
<<s[i].id <<endl;
<<s[i].pwd<<endl;
<<s[i].balance<<endl;

}
out.close();
}

//===========================================================================
//
// => FUNCTION NAME: MAIN()
//
//===========================================================================
void main()
{
clrscr();
textcolor(WHITE);
textbackground(BLACK);
int n;
char tname[20];
char tpwd[20];
int choice;
int c,i;
char tstation1[50],tstation2[50];
int tchoice,tsno1,tsno2;
//textcolor(WHITE);
//getch();
clrscr();
/*
//To make a designer ellipse
int gd=DETECT,gm;
initgraph(&gd, &gm, "c:\\tc\\bgi");
setcolor(8);
ellipse(320,240,0,360,300,150);
settextstyle(10,0,4);
settextjustify(1,1);
setcolor(5);
outtextxy(320,170,"SMART CARD SYS");
delay(250);
settextstyle(4,0,4);
setcolor(20);
outtextxy(320,220,"Presented By:");
delay(250);
setcolor(9);
settextstyle(10,0,4);
outtextxy(320,315,"BALAJI");
setcolor(2);
delay(250);
outtextxy(320,265,"PRADEEPAN");
for (int stangle=0;!kbhit();stangle++)
{
setcolor(7);
ellipse(320,240,stangle,stangle+20,300,150);
ellipse(320,240,stangle+180,stangle+200,300,150);
delay(9);
setcolor(8);
ellipse(320,240,stangle-1,stangle+19,300,150);
ellipse(320,240,stangle-1+180,stangle+199,300,150);
}
closegraph();
getch();

*/
timerlogo();
get();
//timerlogo();
//ustart:

//start:
cout<<"\n\n\n\t\t\t****** \tTHANK YOU ******";
getch();
//return ;
}
//****************************************************************************
//* ---------------- end of main program ------------------------------------//****************************************************************************
//===========================================================================
//
// = FUNCTION NAME: timerlogo
// =
OBJECTIVE: for loading design purpose
//
//===========================================================================
void timerlogo()
{
clrscr();
cout<<"\n\n\n\n\n"<<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<" WELCOME TO RAILWAY SMART CARD MANAGEMENT SYSTEM " <<endl;
cout<<""<<endl;
cout<<""<<endl;
cout<<"\n\n\n\n\t\t\tLOADING ";
for(int i=0;i<10;i++)
{
cout<<".";
delay(600);
}
//getch();
}
void updatedatabase()
{
//rdstno();
readstn();
//rdcno();
readcust();
}

void get()
{
//int usr=0;
//readcustomer();
//readstation();
// updatedatabase();
char tname[20],tpwd[20],a[20];
clrscr();
header();
//rdcno();
//readcustomer();
cout<<"\n\n\t\t\t LOGIN SCREEN ";
cout<<"\n\n\n\tENTER NAME: ";
cin >>tname;
cout<<"\n\tENTER PWD: ";
cin>>tpwd;
//login_star(tpwd);
//cin >>tpwd;
updatedatabase();
if ((strcmp (tname,"admin")==0)&&(strcmp (tpwd,"admin")==0)||(strcmp (tname,"ADM
IN")==0)&&(strcmp (tpwd,"ADMIN")==0))
{
cout<<"\n\n\n\t\t PROCESSING PLEASE WAIT..... ";
//for (int i=0;i<8;i++)
//{
//cout<<".";
//delay (400);
//}
getch();
//goto start;
start();
}

else
{
//rdcno();
//readstation();
//eadcustomer();
for (int i=1;i<=u;i++)
{
if ((strcmp (tname,s[i].id)==0)&&(strcmp (tpwd,s[i].pwd)==0))
{
//usr=i;

//cout<<"\ncustomer(i) no: "<<i<<endl;


getch();
ustart(i);
//goto ustart;
}
}
cout<< "\n\n\tINCORRECT USER NAME PASSWORD...KINDLY RETRY!!!..";
getch();
//goto get;
get();
}
//return;
}

//===========================================================================
//
// = FUNCTION NAME: login star
// =
OBJECTIVE: this function is only for header designing purpose
//
//===========================================================================
void login_star(char *a)
{
//char a[20];
int i;
i=0;
do
{
a[i]=getch();
cout<<"*";
if(a[i]==8)
{
cout<<"\b";
}
if(a[i]==13)
{
a[i]='\0';
break;
}
else
{
i++;
}

}while(a[i-1]!=13);
//cout<<a<<"in func";
//getch();
}

void ustart(int j)
{
//rdcno();
//readcustomer();
time_t tim;
time (&tim);

//ofstream file;
//file.open("ticket.html");
//file <<"myticket";
//file.close();

int usr;
char tstring[50];
usr=j;
int choice,tchoice,tsno1,tsno2;
char tstation1[30],tstation2[30];
strcpy (tstring,s[usr].name);
//cout<<"name"<<tstring;
//getch();
//getch();
//getch();
//rdstno();
//readstation();
//readstation();
simple:
do
{
clrscr();
header();
//cout<<"\n\n\tHI "<<s[usr].name<<", "<<endl;
cout<<"\n\n\tHI "<<tstring<<", "<<endl;
cout<<"\n\n\t\t1.GET TICKET "<<endl;
cout<<"\t\t2.VIEW ALL STATION "<<endl;
cout<<"\t\t3.CHECK BALANCE "<<endl;
cout<<"\t\t4.EXIT "<<endl;
cout<<"\n\n\tENTER YOUR CHOICE: ";
//readstation();

cin >> choice;

switch (choice)
{

case 1:
{
do
{
clrscr();
header();
//cout<<"\n\n\tHI "<<s[usr].name<<", "<<endl;
cout<<"\n\n\tHI "<<tstring<<", "<<endl;
cout<<"\n\n\t\t1.BY ENTER STATION NAME "<<endl;
cout<<"\t\t2.BY ENTER STATION NUMBER "<<endl;
cout<<"\t\t3.BACK TO MAIN MENU "<<endl;
//cout<<"\t\t4.LOGOUT "<<endl;
cout<<"\n\n\tENTER YOUR CHOICE: ";
cin >> tchoice;
switch (tchoice)
{
case 1:
{
reget1:
clrscr();
header();
int flag;
flag=0;
//readstation();
cout<<"\n\n\t************ GET TICKET ************"<<endl;
cout << "\n\n\t
ENTER SOURCE STATION NAME: ";
cin >> tstation1;
cout << "\n\n\t ENTER DESTINATION STATION NAME: ";
cin >> tstation2;
//int l;
if (st==0)
{
cout<<"\n\n\tERROR IN PROCESS"<<endl;
getch();
goto simple;
}

for (int i=1;i<=st;i++)


{

if (strcmp (o[i].station_name,tstation1)==0)
{
for (int l=1;l<=st;l++)
{
if (strcmp(o[l].station_name,tstation2)==0)
{
flag=1;
s[usr].no_of_station=o[i].station_no-o[l].station_no;
if (s[usr].no_of_station <0)
{
s[usr].no_of_station=o[l].station_no-o[i].station_no;

}
int tamt;
s[usr].tcharge=ticketcharge(s[usr].no_of_station);
tamt=s[usr].balance;
s[usr].balance= s[usr].balance - s[usr].tcharge;
//cout<<"\n\tOLD BALANCE: "<<tamt;
//cout<<"\n\n\tNEW BALANCE: "<<s[i].balance;

cout<<"\n\n\tNO OF STATION: "<<s[usr].no_of_station;


cout<<"\n\n\tTICKET CHARGE: "<<s[usr].tcharge;
cout<<"\n\n\tOLD BALANCE: "<<tamt;
cout<<"\n\n\tNEW BALANCE: "<<s[usr].balance;
cout<<"\n\n\tPRINTING TICKET";
for (int i=0;i<15;i++)
{
cout<<".";
delay(300);
}
ofstream file;
file.open("ticket.html");
file<<"<html>";
file<<"<blockqoute>";
file<<"<center>";
file<<" <font color=red><b> <h1> <u> "<< "SOUTHERN RAILWAY TICKET"<<"</h1></b>
</u></font>";
file<<"</center>";

file <<"<h1><br><br> <center> FROM <i> <b> "<<tstation1<<"</b></i> TO <i> <b> "
<<tstation2<<"</b></i></center>";
file<<"<br><h2 align=left>TICKET CHARGE:<b><u> Rs "<<s[usr].tcharge<<"<b></u></
h2>";
file<<"<h2 align=right>RETURN TYPE : <b>NO</b></h2>";
//file<<"<br>
//cout<<"\ntime: " <<ctime(&tim);
file<<"<br><h2><b>DATE: "<<ctime(&tim) <<"</b> </h2>";
file<<"<br><b><h2 align=center>JOURNEY SHOULD COMMENCE WITH IN ONE HOUR!!!!</h2>
<b>";
file<<"<br><blink><h2 align=center>HAPPY JOURNEY!!!! </h2></blink>";
file <<"<br><br><br><hr><hr></h2>";
file<<"</blockqoute></html>";
file.close();
//ofstream file;
//file.open("ticket.txt");
//file <<"myticket";
//file.close();
//ofstream ticket("ticket.html");
//ticket.open("ticket.html");
//ticket.close();

writecust();
//getch();
}
}
}
}
if (flag==0)
{
cout<<"\n\n\tINVALID STATION NAME!!!!";
getch();
goto simple;
}
ext:
//getch();
break;

}
case 2:
{
char tempst1[50],tempst2[50];
int flag;
reget:
flag=0;
clrscr();
header();
cout<<"\n\n\t************ GET TICKET ************"<<endl;
cout<<"\n\n\tENTER SOURCE STATION NUMBER: ";
cin >> tsno1;
cout<<"\n\tENTER DESTINATION STATION NUMBER: ";
cin >> tsno2;
int l;
if (st==0)
{
cout<<"\n\n\tERROR IN PROCESS"<<endl;
//goto ext1;
}
for (int i=1;i<=st;i++)
{
if (o[i].station_no==tsno1)
{
strcpy(tempst1,o[i].station_name);
for (l=1;l<=st;l++)
{
if (o[l].station_no==tsno2)
{
strcpy(tempst2,o[l].station_name);
flag=1;
s[usr].no_of_station=tsno1-tsno2;
if (s[usr].no_of_station <0)
{
s[usr].no_of_station=tsno2-tsno1;

}
int tamt;
s[usr].tcharge=ticketcharge(s[usr].no_of_station);
tamt=s[usr].balance;
s[usr].balance= s[usr].balance - s[usr].tcharge;
//cout<<"\n\tOLD BALANCE: "<<tamt;
//cout<<"\n\n\tNEW BALANCE: "<<s[i].balance;

cout<<"\n\n\tNO OF STATION: "<<s[usr].no_of_station;


cout<<"\n\n\tTICKET CHARGE: "<<s[usr].tcharge;
cout<<"\n\n\tOLD BALANCE: "<<tamt;
cout<<"\n\n\tNEW BALANCE: "<<s[usr].balance;

cout<<"\n\n\tPRINTING TICKET";
for (int i=0;i<15;i++)
{
cout<<".";
delay(300);
}

ofstream file;
file.open("ticket.html");
file<<"<html>";
file<<"<blockqoute>";
file<<"<center>";
file<<" <font color=red><b> <h1> <u> "<< "SOUTHERN RAILWAY TICKET"<<"</h1></b>
</u></font>";
file<<"</center>";
file <<"<h1><br><br> <center> FROM <i> <b> "<<tempst1<<"</b></i> TO <i> <b> "<<
tempst2<<"</b></i></center>";
file<<"<br><h2 align=left>TICKET CHARGE:<b><u> Rs "<<s[usr].tcharge<<"<b></u></
h2>";
file<<"<h2 align=right>RETURN TYPE : <b>NO</b></h2>";
//file<<"<br>
//cout<<"\ntime: " <<ctime(&tim);
file<<"<br><h2><b>DATE: "<<ctime(&tim) <<"</b> </h2>";
file<<"<br><b><h2 align=center>JOURNEY SHOULD COMMENCE WITH IN ONE HOUR!!!!</h2>
<b>";
file<<"<br><blink><h2 align=center>HAPPY JOURNEY!!!! </h2></blink>";
file <<"<br><br><br><hr><hr></h2>";
file<<"</blockqoute></html>";
file.close();
writecust();
}
}
}

}
if (flag==0)
{
cout<<"\n\n\tINVALID STATION NUMBER!!!!";
getch();
goto reget;
}
ext1:
//getch();
break;
}
case 3:
{
//ustart();
goto simple;
//goto ustart;
//break;
}
default:
{
cout<<"\n\t PLEASE ENTER CORRECT CHOICE!!!!!";
getch();
break;
//break;
}
}
}while (tchoice!=NULL);
break;
}

case 2:
{
int i;
if (st==0)
{
cout<<"\n\n\tERROR IN PROCESS"<<endl;
getch();
}
for (i=1;i<=st;i++)
{
clrscr();
header();
//readstation();
cout<<"\n\n\t STATTION DETAILS "<<endl;
cout<<"\n\n\tSTATION NO: "<<o[i].station_no;
cout<<"\n\n\tSTATION NAME: "<<o[i].station_name;
cout<<"\n\n\n\tENTER TO CONTINUE...." ;
getch();
}

break;
}
case 3:
{
clrscr();
header();
cout <<"\n\n\tAVAILABLE AMOUNT: "<< s[usr].balance;
cout <<"\n\n\tCURRENT AMOUNT : "<<s[usr].balance ;
cout<<"\n\n\tENTER TO CONTINUE..."<<endl;
getch();
break;
}
case 4:
{
clrscr();
header();
cout<<"\n\n\n\n\tThanks for using our service";
for (int i=0;i<4;i++)
{
cout<<"!";
delay(300);
}
cout<<"\n\n\t##### Give us chance to serve you again.";
for (i=0;i<5;i++)
{
cout<<"#";
delay(300);
}
//getch();
//get();
exit (0);
//goto get;
//break;
}
default:
{
cout<<"\n\t PLEASE ENTER CORRECT CHOICE!!!!!";
getch();
break;
//break;
}
}
}while (choice!=NULL);
//return;
}

void smartprocess()
{
int choice;
getamt:
do
{
clrscr();
header();
cout<<"\n\n\tHI ADMIN, "<<endl;
cout<<"\n\n\t\t1.CREATE ACCOUNT "<<endl;
cout<<"\t\t2.VIEW CUSTOMER ACCOUNT"<<endl;
cout<<"\t\t3.MODIFY ACCOUNT "<<endl;
//cout<<"\t\t3.TOP UP SMART CARD"<<endl;
cout<<"\t\t4.TOP UP SMART CARD"<<endl;
cout<<"\t\t5.BACK TO MAIN MENU"<<endl;
cout<<"\t\t6.EXIT "<<endl;
cout<<"\n\n\tENTER YOUR CHOICE: ";
cin>> choice;
switch (choice)
{
case 1:
{
u++;
s[u].get_custdata();
writecust();
//wrcno();
break;
}
case 2:
{
int i;
for (i=1;i<=u ;i++)
{
clrscr();
header();
s[i].printcustomer();
getch();
}
break;
}
case 3:
{
customermodification();
break;
}
case 4:
{
clrscr();

header();
char tid[100];
int amt,i,tamt;
//readcustomer();
cout<<"\n\n\tENTER USER ID: ";
cin >> tid;
for (i=1;i<=u;i++)
{
if (strcmp (s[i].id,tid)==0)
{
tamt= s[i].balance;
cout<<"\n\n\tENTER THE AMOUNT FOR TOP UP: ";
cin>> amt;
s[i].balance= s[i].balance + amt;
cout<<"\n\tOLD BALANCE: "<<tamt;
cout<<"\n\n\tNEW BALANCE: "<<s[i].balance;
cout<<"\n\n\tTHE AMOUNT SUCCESSFULLY ADDED!!!"<<endl;
writecust();
getch();
smartprocess();
}
//else
//{
//cout<<"\n\n\tUSER ID IS IN VAILD!!!!"<<endl;
//getch();
//goto getamt;
//}
}

cout<<"\n\n\tUSER ID IS IN VAILD!!!!"<<endl;
getch();
smartprocess();
//goto getamt;
//getch();

//break;
}
case 5:
{
start();
//goto start;
}
case 6:
{
clrscr();

header();
cout<<"\n\n\n\n\t************* THANK YOU **************";
getch();
exit (0);
}
default:
{
cout<<"\n\t PLEASE ENTER CORRECT CHOICE!!!!!";
getch();
break;
}
}
}while (choice!=NULL);
//return;
}

void start()
{
int choice;
do
{
clrscr();
header();
//rdcno();
//readcustomer();
//rdstno();
//readstation();
cout<<"\n\n\tHI ADMIN, "<<endl;
cout<<"\n\n\t\t1.SMART APPLICATION "<<endl;
cout<<"\t\t2.STATION MANAGEMENT "<<endl;
cout<<"\t\t3.EXIT "<<endl;
//cout<<"\t\t4.EXIT "<<endl;
cout<<"\n\n\tENTER YOUR CHOICE: ";
cin >> choice;

switch (choice)
{

case 1:
{
//goto smart_process;
smartprocess();
//break;
}

case 2:
{

//***************************************************************
//-------------station management -----------------------------//***************************************************************
int c;
do
{
clrscr();
header();
cout<<"\n\n\tHI ADMIN, "<<endl;
cout<<"\n\n\t\t1.ADD STATION DETAILS "<<endl;
cout<<"\t\t2.MODIFY STATION DETAILS "<<endl;
cout<<"\t\t3.VIEW ALL STATION DETAILS "<<endl;
cout<<"\t\t4.BACK TO MAIN MENU "<<endl;
cout<<"\n\n\tENTER YOUR CHOICE: ";
cin >> c;
switch (c)
{
case 1:
{
st++;
o[st].getstation();
//wrstno();
//clear();
writestn();
break;
}
case 2:
{
stationmodification();
break;
}
case 3:
{
int i;
for (i=1;i<=st;i++)
{
clrscr();
header();
cout<<"\n\n\t STATTION DETAILS "<<endl;
cout<<"\n\n\tSTATION NO: "<<o[i].station_no;
cout<<"\n\n\tSTATION NAME: "<<o[i].station_name;
cout<<"\n\n\n\tENTER TO CONTINUE...." ;
getch();
}
break;
}
case 4:
{
//writestation();

//wrstno();
start();
//goto start;
//break;
}
default:
{
cout<<"\n\t PLEASE ENTER CORRECT CHOICE!!!!!";
getch();
break;
}
}
}while (c!=NULL);
//*************************************************************
//end of station management
//*************************************************************

break;
}
case 3:
{
clrscr();
header();
cout<<"\n\n\n\n\t************* THANK YOU **************";
getch();
exit (0);
//get();
//goto get;
//break;
}
/*case 4:
{
exit (0);
break;
} */
default:
{
cout<<"\n\t PLEASE ENTER CORRECT CHOICE!!!!!";
getch();
break;
}
}
}while(choice!=NULL);
//return;
}

void stationmodification()
{
int cno;
int nno;
char nname[50];
clrscr();
header();
cout<<"\n\n\t************* MODIFICATION FORM************* "<<endl;
cout<<" \n\n\tENTER OLD STATION NUMBER: " ;
cin>>cno;
for (int i=1;i<=st;i++)
{
if (cno==o[i].station_no)
{
cout<<"\n\n\tENTER STATION NUMBER: ";
cin>>nno;
cout<<"\n\n\tENTER STAION NAME: ";
cin>>nname;
o[i].station_no=nno;
strcpy(o[i].station_name,nname);
cout<<"\n\n\tTHE STATION DETAILS HAS BEEN SUCCESSFULLY CHANGED!!!";
//return
getch();
//clear();
writestn();
return;
}
}
cout<<"\n\n\tINVALID STATION NUMBER!!!! KINDLY RETRY!!!";
getch();
}
void customermodification()
{
long int cpincode;
int cbalance;
char tid[50],cname[50],ccity[50],cid[50],cpwd[50];
clrscr();
header();
cout<<"\n\n\t************* MODIFICATION FORM************* "<<endl;
cout<<"\n\n\t ENTER OLD CUSTOMER ID: " ;
cin>>tid;
for (int i=1;i<=u;i++)
{
if (strcmp(tid,s[i].id)==0)
{
cout<<"\n\tNAME : ";
cin>>cname;
cout<<"\n\tCITY : ";
cin>> ccity;
cout<<"\n\tPINCODE
: ";
cin>> cpincode;

cout<<"\n\tID
: ";
cin>> cid;
cout<<"\n\t PASSWORD : ";
cin>> cpwd;
cout<<"\n\t BALANCE : ";
cin>> cbalance;
s[i].balance=cbalance;
s[i].pincode=cpincode;
strcpy(s[i].name , cname);
strcpy (s[i].city , ccity);
strcpy (s[i].id , cid);
strcpy( s[i].pwd , cpwd);
cout<<"\n\n\tTHE CUSTOMER DETAILS HAS BEEN SUCCESSFULLY UPDATED!!!";
writecust();
getch();
return;
}
}
cout<<"\n\n\tINVALID CUSTOMER ID !!!! KINDLY RETRY!!!";
getch();
}
//===========================================================================
//
// = FUNCTION NAME: header
// =
OBJECTIVE: this function is only for header designing purpose
//
//===========================================================================
void header()
{
cout<<"*************************************************************************
*****" <<endl ;
cout<<"*************************************************************************
*****" <<endl ;
cout<<"***********\tWELCOME TO RAILWAY MANAGEMENT SYSTEM \t*********************
*"<<endl;
cout<<"*************************************************************************
*****" <<endl ;
cout<<"*************************************************************************
*****" <<endl ;
}
//===========================================================================
//
//
=> FUNCTION NAME: ticket charge.
//
=>
OBJECTIVE: it takes the no of station as a input
//
and gives the ticket charge for that journey station.
//

//===========================================================================
int ticketcharge (int k)
{
if ((k>=0)&&(k<=2))
return 4;
else if ((k>=3)&&(k<=5))
return 6;
else if ((k>=6)&&(k<=9))
return 8;
else
return 15;
//return 0;
}
//
// ------------------- end of the program ---------------------------------//

You might also like