50% found this document useful (12 votes)
12K views

Coding On Travel Management in C++

This document contains code for a C++ program that implements a menu-driven system for managing different departments. It includes code to define classes for administrative, marketing, employee, road, and password modules. The main class book inherits from these other classes. The book class menu() function displays a main menu and uses switch cases to call functions from the other classes based on the user's selection, such as calling the admin class look() function for the administrative options. The admin class further inherits from other classes and its look() function displays an administrative menu to call additional functions like viewing employee status or generating different reports.

Uploaded by

9990737578
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
50% found this document useful (12 votes)
12K views

Coding On Travel Management in C++

This document contains code for a C++ program that implements a menu-driven system for managing different departments. It includes code to define classes for administrative, marketing, employee, road, and password modules. The main class book inherits from these other classes. The book class menu() function displays a main menu and uses switch cases to call functions from the other classes based on the user's selection, such as calling the admin class look() function for the administrative options. The admin class further inherits from other classes and its look() function displays an administrative menu to call additional functions like viewing employee status or generating different reports.

Uploaded by

9990737578
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 213

#include<iostream.

h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<dos.h>
#include<stdlib.h>
#include"d:\gaurav\screen.cpp"
#include"d:\gaurav\clear3.cpp"
#include"d:\gaurav\box.cpp"
#include"d:\gaurav\box1.cpp"
#include"d:\gaurav\box2.cpp"
#include"d:\gaurav\box3.cpp"
#include"d:\gaurav\dbox.cpp"
#include"d:\gaurav\clear.cpp"
#include"d:\gaurav\clear1.cpp"
#include"d:\gaurav\clear2.cpp"
#include"d:\gaurav\help.cpp"
#include"d:\tc\password.cpp"
#include"d:\gaurav\status.cpp"
#include"d:\gaurav\market.cpp"
#include"d:\gaurav\employ.cpp"
#include"d:\gaurav\road.cpp"
class book:public road,password,status,market,employ
{
public:
void menu();
};
void book::menu()
{
clrscr();
login();
char check;
do
{
clrscr();
xyz:
clrscr();
textcolor(WHITE);
screen();
gotoxy(37,16);
cout<<"MAIN MENU";
screen1();
gotoxy(25,20);
textcolor(GREEN);
cprintf(" 1. ADMINISTRATIVE DEPARTMENT");
gotoxy(25,23);
cprintf(" 2. MARKETING DEPARTMENT");
gotoxy(25,26);
cprintf(" 3. EMPLOYEEE DEPARTMENT");
gotoxy(25,29);
cprintf(" 4. ROADWAYS DEPARTMENT");
gotoxy(25,32);
cprintf(" 5.PASSWORD");
gotoxy(25,35);
cprintf(" 6.HELP");
gotoxy(25,38);
cprintf(" 7. EXIT");
textcolor(YELLOW+BLINK);
gotoxy(26,39);
_setcursortype(_SOLIDCURSOR);

cprintf("ENTER YOUR CHOICE:");


textcolor(WHITE);
gotoxy(44,39);
check=getch();
switch(check)
{
case '1':
clrscr();
admin::look();
goto xyz;
case '2':
clrscr();
market::make();
goto xyz;
case '3':
clrscr();
employ::move();
goto xyz;
case '4':
clrscr();
road::march();
goto xyz;
case '5':
clrscr();
password::menu();
goto xyz;
case '6':
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(21,10);
cprintf("\nTHE TRAVEL AND TRANSPORT MANAGEMENT
SYSTEM");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(18,15);
cprintf("IF CHOICE:1# ");
textcolor(11);
gotoxy(26,16);
cprintf("The User can work with the ");
gotoxy(26,18);
cprintf("Administrative Department Menu.");
textcolor(RED);
gotoxy(18,20);
cprintf("IF CHOICE:2# ");
textcolor(11);
gotoxy(26,21);
cprintf("The User can Work with the");
gotoxy(26,23);
cprintf("Marketing Department Menu.");
textcolor(RED);
gotoxy(18,25);
cprintf("IF CHOICE:3# ");
textcolor(11);
gotoxy(26,26);
cprintf("The user can work with");
gotoxy(26,28);
cprintf("Employee Department Menu.");
gotoxy(18,30);
textcolor(RED);
cprintf("IF CHOICE:4# ");
textcolor(11);
gotoxy(26,31);
cprintf("The user can work with");
gotoxy(26,33);
cprintf("Roadways Department Menu.");
textcolor(RED);
gotoxy(18,35);
cprintf("IF CHOICE:5# ");
textcolor(11);
gotoxy(26,36);
cprintf("The user can work with Password Menu");
gotoxy(26,39);
textcolor(5);
cprintf("Press Any Key To Continue........");
textcolor(WHITE);
getch();
goto xyz;
case '7':
clrscr();
gotoxy(22,22);
cout<<"Thanks For Using This Software...";
getch();
exit(1);
default :
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto xyz;
}

}while(1);
}
void main()
{
textbackground(BLACK);
clrscr();
book mo;
mo.menu();
getch();
}
End of main class coding.
 Administrative Module Coding:

Starting of admin class coding:

/*-------------------Including of classes for


Inheritence--------------------------*/
#include"d:\gaurav\elook.cpp"
#include"d:\gaurav\recruit.cpp"
#include"d:\gaurav\budget.cpp"
#include"d:\gaurav\income.cpp"
#include"d:\gaurav\salary.cpp"
/*-------------------End of Including of
classes------------------------------------*/
/*--------------------Starting of admin class for Administrative
Department Menu generation-----------------------*/
class admin:public
employee,recruitment,income,budget//declaration of class with the
inheritence of salary,budget,employee and recruitment class
{
public:
void look();//declaration of function for Administraive
Module menu creation
};//End of class declaration
/*--------------------------Starting of function definition
---------------------------*/
void admin::look()
{
abc:
char first;
clrscr();
screen();
gotoxy(28,16);
cout<<"ADMINISTRATIVE DEPARTMENT MENU";
screen1();
textcolor(GREEN);
gotoxy(24,21);
cprintf(" 1. DEPARTMENT STATUS");//calling for department
status menu
gotoxy(24,24);
cprintf(" 2. EMPLOYEE RECRUITMENT DIVISION");//calling for
employee recruitment division
gotoxy(24,27);
cprintf(" 3. ACCOUNT DIVISION");//calling of account division
menu
gotoxy(24,30);
cprintf(" 4. REPORT");//calling for report generation
gotoxy(24,33);
cprintf(" 5. HELP");//calling for help generation
gotoxy(24,36);
cprintf(" 6. RETURN TO MAIN");//return to main menu
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
gotoxy(43,38);
first=getch();
switch(first)
{
case '1'://department status menu generation
dep:
char ch6;
clrscr();
screen3();
gotoxy(28,15);
textcolor(CYAN);
cprintf("ADMINISTRATIVE DEPARTMENT");
gotoxy(27,17);
cprintf("DEPARTMENT STATUS SUBMENU");
screen1();
textcolor(GREEN);
gotoxy(23,22);
cprintf("[1] Employee Status");//for checking of
employee status
gotoxy(23,25);
cprintf("[2] Employee Recruitment Status");//for
checking for recruitment status
gotoxy(23,28);
cprintf("[3] Account Status");//checking of account
status
gotoxy(23,31);
cprintf("[4] Help");//for help generation
gotoxy(23,34);
cprintf("[5] Return to Administrative Menu");
textcolor(YELLOW+BLINK);
gotoxy(32,37);
cprintf("Enter Your choice:");
textcolor(WHITE);
ch6=getch();
switch(ch6)
{
case '1': //calling of employee_details from
employee class
clrscr();
employee estu;
estu.employee_details();
getch();
goto dep;
case '2'://calling of recruitment_display from
recruitment class
clrscr();
recruitment rlu;
rlu.recruitment_display();
gotoxy(25,42);
cout<<"Press Any Key To Continue........";
getch();
goto dep;
case '3'://calling for report generation menu
dep1:
clrscr();
char ch7;
screen2();
textcolor(RED);
cprintf("\nREPORT SUBMENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(33,10);
cprintf("\nACCOUNT DIVISION");
textcolor(WHITE);
screen4();
gotoxy(23,21);
textcolor(5);
cprintf("1.Income Report");//for income
report generation
gotoxy(23,24);
cprintf("2.Salary Report");//for salary
report generation
gotoxy(23,27);
cprintf("3.Budget Report");//for budget
report generation
gotoxy(23,30);
cprintf("4.Return To Department Status
Submenu ");
textcolor(WHITE);
textcolor(YELLOW+BLINK);
gotoxy(25,32);
cprintf("Enter Your Choice");
textcolor(WHITE);
ch7=getch();
switch(ch7)
{
case '1'://calling of income_show
function from income class
clrscr();
income inc;
inc.income_show();
getch();
goto dep1;
case '2'://calling of salary_show
function from salary class
clrscr();
salary salu;
salu.salary_show();
getch();
goto dep1;
case '3'://calling of budget_display
function from budget class
clrscr();
budget buk;
buk.budget_display();
getch();
goto dep1;
case '4':
goto dep;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please
retry!!");
textcolor(WHITE);
getch();
goto dep1;
}
case '4'://calling for help generation
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(32,10);
cprintf("\nDEPARTMENT STATUS");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(18,18);
cprintf("IF CHOICE:1# ");
textcolor(GREEN);
gotoxy(26,21);
cprintf("The user can take Information
about");
gotoxy(26,23);
cprintf("Employee Status.");
textcolor(RED);
gotoxy(18,25);
cprintf("IF CHOICE:2# ");
textcolor(GREEN);
gotoxy(26,27);
cprintf("The user can take Information
about");
gotoxy(26,29);
cprintf("Employee Recruitment Status.");
textcolor(RED);
gotoxy(18,31);
cprintf("IF CHOICE:3# ");
textcolor(GREEN);
gotoxy(26,33);
cprintf("The user can take and generate
Report");
gotoxy(26,35);
cprintf("about account Status.");
gotoxy(18,42);
textcolor(5);

cprintf("Press Any Key To


Continue........");
textcolor(WHITE);
getch();
goto dep;
case '5':
goto abc;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto dep;
}
case '2'://calling of rcruitment menu
clrscr();
recruitment req1;
req1.recruitment_menu();
goto abc;
case '3'://calling of account division
again:
char chor;
clrscr();
screen3();
gotoxy(28,15);
cout<<"ADMINISTRATIVE DEPARTMENT";
gotoxy(31,17);
cout<<"ACCOUNT DIVISION";
screen1();
textcolor(GREEN);
gotoxy(23,23);
cprintf("[1] Income Section");//calling for income
section
gotoxy(23,26);
cprintf("[2] Salary Section");//calling for salary
section
gotoxy(23,29);
cprintf("[3] Budget Section");//calling for budget
section
gotoxy(23,32);
cprintf("[4] Help");//calling for help generation
gotoxy(23,35);
cprintf("[5] Return to Administrative Menu");
textcolor(YELLOW+BLINK);
gotoxy(32,38);
cout<<"Enter Your choice:";
textcolor(WHITE);
chor=getch();
switch(chor)
{
case '1'://calling of income menu
clrscr();
income inco;
inco.income_menu();
goto again;
case '2'://calling of salary menu
clrscr();
salary salo;
salo.salary_menu();
goto again;
case '3'://calling of budget menu
clrscr();
budget buga;
buga.budget_menu();
goto again;
case '4'://for help generation
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(32,10);
cprintf("\nACCOUNT DIVISION");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(18,18);
cprintf("IF CHOICE:1# ");
textcolor(11);
gotoxy(26,20);
cprintf("The user can make Entry,
Modification,");
gotoxy(26,22);
cprintf("Deletion and Details of Income
Details.");
textcolor(RED);
gotoxy(18,24);
cprintf("IF CHOICE:2# ");
textcolor(11);
gotoxy(26,26);
cprintf("The user can make Entry,
Modification,");
gotoxy(26,28);
cprintf("Deletion and Details of Salary
Details.");
textcolor(RED);
gotoxy(18,30);
cprintf("IF CHOICE:3# ");
textcolor(11);
gotoxy(26,32);
cprintf("The user can make Entry,
Modification,");
gotoxy(26,34);
cprintf("Deletion and Details of Budget
Details.");
textcolor(RED);
gotoxy(18,36);
cprintf("IF CHOICE:4# ");
textcolor(11);
gotoxy(26,38);
cprintf("The user can take Help For");
gotoxy(26,40);
cprintf("Account Devision.");
gotoxy(18,42);
textcolor(5);
cprintf("Press Any Key To Continue........");
textcolor(WHITE);
getch();
goto again;
case '5':
goto abc;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto again;
}
case '4': //for report menu generation
adm:
clrscr();
char ch8;
screen2();
textcolor(RED);
cprintf("\nREPORT MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(29,10);
cprintf("\nADMINISTRATIVE DEPARTMENT");
textcolor(WHITE);
screen1();
gotoxy(23,21);
textcolor(5);
cprintf("1.Employee Report");//generation for
employee report
gotoxy(23,24);
cprintf("2.Employee Recruitment Report");//generation
of employee recruitment report
gotoxy(23,27);
cprintf("3.Income Report");//generation of income
report
gotoxy(23,30);
cprintf("4.Salary Report For Administrative
Purpose");//generation of salary report
gotoxy(23,33);
cprintf("5.Budget Report");//generation of budget
report
gotoxy(23,36);
cprintf("6.Return To Administrative Menu");
textcolor(WHITE);
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice");
textcolor(WHITE);
ch8=getch();
switch(ch8)
{
case '1'://calling of employee_details function
from employee class
clrscr();
employee eps;
eps.employee_details();
getch();
goto adm;
case '2'://calling of recruitment_display function
from recruitment class
clrscr();
recruitment reco1;
reco1.recruitment_display();
getch();
goto adm;
case '3'://calling of income_show function from
income class
clrscr();
income incom;
incom.income_show();
getch();
goto adm;
case '4'://calling of salary_show from salary
class
clrscr();
salary salo2;
salo2.salary_show();
getch();
goto adm;
case '5'://calling of budget_display class from
budget class
clrscr();
budget bug3;
bug3.budget_display();
getch();
goto adm;
case '6':
goto abc;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto adm;
}
case '5'://help menu generation for Administrative menu
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(29,10);
cprintf("\nADMINISTRATIVE DEPARTMENT");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(18,16);
cprintf("IF CHOICE:1# ");
textcolor(11);
gotoxy(26,18);
cprintf("The user can check the Department
Status.");
textcolor(RED);
gotoxy(18,20);
cprintf("IF CHOICE:2# ");
textcolor(11);
gotoxy(26,22);
cprintf("The user can make Entry, Modification,");
gotoxy(26,24);
cprintf("Deletion and Details of Employee
Recruitment");
gotoxy(26,26);
cprintf("Division.");
textcolor(RED);
gotoxy(18,28);
cprintf("IF CHOICE:3# ");
textcolor(11);
gotoxy(26,30);
cprintf("The user can work with the Account
Division.");
textcolor(RED);
gotoxy(18,32);
cprintf("IF CHOICE:4# ");
textcolor(11);
gotoxy(26,34);
cprintf("The user can Generate Report For");
gotoxy(26,36);
cprintf("all above choices");
gotoxy(18,40);
textcolor(5);
cprintf("Press Any Key To Continue........");
textcolor(WHITE);
getch();
goto abc;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto abc;
}
}
/*----------------------------End of admin
class-------------------------------*/
End of admin class coding

Starting of budget class coding:

/*-------------------------Starting of budget
class--------------------*/
class budget//Declaration of budget class with inheritence of
shape class
{
protected:
/*Declaration of variable for access control*/
int valid;
int ch1;
char ch;

/*End of declaration*/
fstream fin,fin1; //Declaration of fstream variable
/*Structure declaration for data,with data dypes*/
struct budget1
{
int snum;
int plan;
char period[12];
char department[15];
char purpose[25];
float amt;
}bug;
/*End of declaration*/
public:
budget()//constructor declaration
{
fin.open("budget.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit6();
}
bug.snum=1;//assignment of serial number
}
~budget()//destructor declaration
{
fin.close();
delete bug.period,bug.department,bug.purpose;//deletion
of structure explicitly
}
/*declaraton of function for budget class*/
void budget_create(void);
void budget_display(void);
void budget_modify(void);
void budget_del(void);
void budget_menu();
void budget_query();
void budget_save();
void exit6();
/*end of function declaration*/
};
/*starting of menu function*/
void budget::budget_menu()
{
textbackground(BLACK);
again3:
clrscr();
char ch3;
screen3();
gotoxy(18,15);
textcolor(CYAN);
cprintf("Account Division of Administrative Department");
gotoxy(31,17);
cprintf("Budget Division");
textcolor(WHITE);
screen1();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Budget Entry"); //for budget entry
gotoxy(25,24);
cprintf("[2] Budget Details");//for details show and report
generation
gotoxy(25,27);
cprintf("[3] Budget Deletion");//for deletion of details
gotoxy(25,30);
cprintf("[4] Budget Modification");//for modification of
datails
gotoxy(25,33);
cprintf("[5] Query for Budget section");//for budget query
gotoxy(25,36);
cprintf("[6] Return To Account Division Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
ch3=getch();
switch(ch3)
{
case '1'://calling of budget_create function
clrscr();
budget_create();
repea3:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
getch();
char more3;
cin>>more3;
switch(more3)
{
case '1':
budget_create();//calling of more entry
goto repea3;
case '2':
goto again3;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto repea3;
}
case '2'://calling of budget_display function
budget bol1;
bol1.budget_display();
getch();
goto again3;
case '3': //calling of budget_del function
budget bol2;
bol2.budget_del();
getch();
goto again3;
case '4'://calling of budget_modify function
budget bol3;
bol3.budget_modify();
getch();
goto again3;
case '5'://calling of budget_query function
budget bol4;
bol4.budget_query();
getch();
goto again3;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto again3;
}
}//end of menu function
/*strating of budget_save function*/
void budget::budget_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&bug,sizeof(bug));
gotoxy(23,38);
cout<<"Budget Details Entered.....";
bug.snum++;//incrementation of serial number
clear(25,42);
gotoxy(50,38);
}
else
{
gotoxy(57,42);
return;
}
}//end of budget_save function
void budget::exit6()//function for Error checking durin file
handling
{
fin.close();
}
/*starting of budget_create function*/
void budget::budget_create()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(34,10);
cprintf("\nBUDGT DETAILS");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,21);
cprintf("Serial Number :");
gotoxy(18,24);
cprintf("Enter The Year of Plan :");
gotoxy(18,27);
cprintf("Enter The Period of Plan :");
gotoxy(18,30);
cprintf("Enter The Name of Department :");
gotoxy(18,33);
cprintf("Enter The Purpose :");
gotoxy(18,36);
cprintf("Enter The Total Amount :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(52,21);
cout<<bug.snum;//generation of the serial number by constructor
do
{
valid=1;
gotoxy(52,24);
cin>>bug.plan;
ch1=bug.plan;
if (ch1==0)
{
valid=0;
gotoxy(22,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(52,24);
clear(52,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,27);
gets(bug.period);
ch=strlen(bug.period);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,27);
clear(52,27);
}

}while(!valid);
do
{
valid=1;
gotoxy(52,30);
gets(bug.department);
ch=strlen(bug.department);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,30);
clear(52,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,33);
gets(bug.purpose);
ch=strlen(bug.purpose);
if (ch== 0 || ch>=25)
{
valid=0;

gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,33);
clear(52,33);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,36);
cin>>bug.amt;
float ch= bug.amt;
if (ch== 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(52,36);
clear(52,36);
}
}while(!valid);
budget_save();
getch();
}//end of budget_create function
/*starting of budget_display function*/
void budget::budget_display(void)
{
clrscr();
textcolor(RED);
int m=9;
gotoxy(22,2);
textcolor(RED);
cprintf("THE TRAVEL AND TRANSPORT AGENCY\n");
gotoxy(29,4);
cprintf("Budget Details");
textcolor(WHITE);
gotoxy(3,5);
cprintf("\n----------------------------------------------------
------------------------");
gotoxy(3,7);
textcolor(BLUE);
cprintf("Serial No.");
gotoxy(13,7);
cprintf("Plan_Year");
gotoxy(24,7);
cprintf("Period");
gotoxy(36,7);
cprintf("Department");
gotoxy(56,7);
cprintf("Purpose");
gotoxy(72,7);
cprintf("Amount");
textcolor(WHITE);
gotoxy(3,8);
cout<<"--------------------------------------------------------
--------------------\n\n";
textcolor(WHITE);
fin.seekg(0,ios::beg);
while(fin.read((char*)&bug,sizeof(bug))!=0)
{
gotoxy(4,m);
cout<<bug.snum;
gotoxy(13,m);
cout<<bug.plan;
gotoxy(24,m);
cout<<strupr(bug.period);
gotoxy(36,m);
cout<<strupr(bug.department);
gotoxy(56,m);
cout<<strupr(bug.purpose);
gotoxy(72,m);
cout<<bug.amt;
m++;
}
}//end of budget_display function
/*starting of budgte_modify function*/
void budget::budget_modify(void)
{
clrscr();
int number1;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nBUDGET DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter The Serial Number To be Modified:");
cin>>number1;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&bug,sizeof(bug)))

{
if(bug.snum!=number1)
count++;
else
{
int ck;
/*displaying of old value for reference*/
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Serial Number :");cout<<bug.snum;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,25);
cprintf("Year of Plan :");cout<<bug.plan;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,27);
cprintf("Period of Plan:");cout<<bug.period;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Department :");cout<<bug.department;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,31);
cprintf("Purpose :");cout<<bug.purpose;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,33);
cprintf("Amount :");cout<<bug.amt;
textcolor(WHITE);
/*Entry of new value for modification*/
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Serial Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,23);
cin>>bug.snum;
ck=bug.snum;
if(ck!=number1)
{
valid=0;
gotoxy(40,38);
cout<<"Its a Duplicate entry";
getch();
clear3(40,38);
gotoxy(56,23);
clear3(56,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Year of Plan :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,25);
cin>>bug.plan;
ch1=bug.plan;
if (ch1 == 0)
{
valid=0;
gotoxy(40,38);
cout<<"Can Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(56,25);
clear3(56,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("Period of Plan :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,27);
gets(bug.period);
ch=strlen(bug.period);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cout<<"Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,27);
clear3(56,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Depatment Name :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,29);
gets(bug.department);
ch=strlen(bug.department);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,29);
clear3(56,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("The Purpose :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,31);
gets(bug.purpose);
ch=strlen(bug.purpose);
if (ch== 0 || ch>=25)
{
valid=0;
gotoxy(40,38);
cout<<"Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,31);
clear3(56,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("Total Amount :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,33);
cin>>bug.amt;
float ch= bug.amt;
if (ch== 0)
{
valid=0;
gotoxy(40,38);
cout<<"Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(56,33);
clear3(56,33);
}
}while(!valid);
pos=count*sizeof(bug);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&bug,sizeof(bug));
gotoxy(42,38);
cout<<"Budget Details modified....";
gotoxy(68,38);
return;
}
else
return;
}
}
if(pos==0)
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of budget_modify function
/*starting of budget_del function*/
void budget::budget_del(void)
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(34,10);
cprintf("\nBUDGET DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("temp3.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Serial No.To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&bug,sizeof(bug)))
{
if(bug.snum!=code1)
fin1.write((char*)&bug,sizeof(bug));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("budget.dat");
rename("temp3.dat","budget.dat");
fin.open("budget.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
}//end of budget_modify function
/*starting of budget_query function*/
void budget::budget_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nBUDGET DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Serial Number To be Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&bug,sizeof(bug))!=0)
{
if(bug.snum!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nBUDGET DETAILS");
textcolor(WHITE);
gotoxy(27,16);
cout<<"Quried Budget Year:"<<vac;
textcolor(CYAN);
gotoxy(20,22);
cprintf("Serial Number :");
gotoxy(20,24);
cprintf("Year of Plan :");
gotoxy(20,26);
cprintf("Period of plan :");
gotoxy(20,28);
cprintf("Name of Department :");
gotoxy(20,30);
cprintf("Purpose :");
gotoxy(20,32);
cprintf("Total Amount :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(44,22);
cout<<bug.snum;
gotoxy(44,24);
cout<<bug.plan;
gotoxy(44,26);
cout<<strupr(bug.period);
gotoxy(44,28);
cout<<strupr(bug.department);
gotoxy(44,30);
cout<<strupr(bug.purpose);
gotoxy(44,32);
cout<<bug.amt;
s++;
if (bug.snum==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}
/*end ofbudget_modify function*/
/*--------------------------End of Budget
Class-------------------------*/
End of budget class coding.

Starting of salary class coding:

/*----------------------------Starting of salary class


---------------------------------*/
class salary:public employee//class declaration
{
protected:
int valid;
/*starting of structure declaration for data with their
data types*/
struct salary1
{
int emp_jcode;
char emp_dep[17];
char mode[8];
float emp_sal;
char pdate[15];
}sal;//end of structure declaration*/
fstream fin,fin1,fin2;//declaration of fstream variable
public:
salary()//constructor declaration
{
fin.open("salary3.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)//error/exception handling during file handling
{
gotoxy(22,22);
cout<<"Unable To open File";
getch();
exit2();
}
}
~salary()//destructor declaration
{
fin.close();//closing of file stream
delete sal.emp_dep,sal.mode,sal.pdate;//deletion of
struct data explicitly
}
/*starting of function declaration*/
void salary_entry();
void salary_show();
void salary_del();
void salary_modify();
void salary_menu();
void salary_query();
void salary_save();
void exit2();
/*end of function declaration*/
};//end of class declaration
/*starting of salary_menu function definition*/
void salary::salary_menu()
{
again2:
clrscr();
char ch3;
screen3();
gotoxy(18,15);
textcolor(CYAN);
cprintf("Account Division of Administrative Department");
gotoxy(31,17);
cprintf("Salary Division");
screen1();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Salary Entry");//for entering of data
gotoxy(25,24);
cprintf("[2] Salary Details");//for details/report generation
gotoxy(25,27);
cprintf("[3] Salary Deletion");//for record deletion
gotoxy(25,30);
cprintf("[4] Salary Modification");//for record modification

gotoxy(25,33);
cprintf("[5] Query for Salary Details");//for query
gotoxy(25,36);
cprintf("[6] Return To Account Division Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
ch3=getch();
switch(ch3)
{
case '1'://calling of salary_entry function
clrscr();
salary_entry();
repea2:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char more2;
cin>>more2;
switch(more2)
{
case '1'://for more entry
clrscr();
salary_entry();
goto repea2;
case '2':
goto again2;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto repea2;
}
case '2'://calling of salary_show function
salary som;
som.salary_show();
fin.clear();
getch();
goto again2;
case '3'://calling of salary_del function
salary som1;
som1.salary_del();
fin.clear();
getch();
goto again2;
case '4'://calling of salary_modify function
salary som2;
som2.salary_modify();
fin.clear();
getch();
goto again2;
case '5'://calling of salary_query function
salary som3;
som3.salary_query();
fin.clear();
getch();
goto again2;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto again2;
}
}//end of function definition
/*starting of salary_save function body definition*/
void salary::salary_save()
{
char in;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&sal,sizeof(sal));
gotoxy(23,38);
cout<<"Salary Details Entered.....";
clear(25,42);
gotoxy(52,38);
}
else
gotoxy(56,42);
return;
}//end of function definition
//starting of exit function for error handling
void salary::exit2()
{
fin.close();
}
//end of function definition
/*starting of salary_entry function definition*/
void salary::salary_entry()
{
int valid;
clrscr();
screen2();
screen1();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nSALARY DETAILS");

textcolor(CYAN);
gotoxy(20,23);
cprintf("Enter The Job_Code :");
gotoxy(20,26);
cprintf("Enter The Department Name :");
gotoxy(20,29);
cprintf("Enter The Mode of Payment :");
gotoxy(20,32);
cprintf("Enter The Salary :");
gotoxy(20,35);
cprintf("Enter The date Of payment :");
textcolor(WHITE);
fin.seekp(0,ios::end);
do
{
valid=1;
employee::employee1 elo1;
fin2.open("elook.dat",ios::in);
gotoxy(51,23);
cin>>sal.emp_jcode;
int ch=sal.emp_jcode;
fin2.seekg(0,ios::beg);
while(fin2.read((char*)&elo1,sizeof(elo1))!=0)
{
if(ch==elo1.jcode)
{
gotoxy(18,38);
cout<<"Thanks Its a valid entry";
getch();
clear(18,38);

gotoxy(51,23);
}
else
{
gotoxy(18,38);
cout<<"This Job code is not valid,please retry!";
getch();
return;
}
}
}while(!valid);
do
{
valid=1;
gotoxy(51,26);
gets(sal.emp_dep);
char ch=strlen(sal.emp_dep);
if (ch== 0 || ch>=16)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,26);
clear(51,26);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,29);
gets(sal.mode);
char ch=strlen(sal.mode);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";

getch();
clear(18,38);
gotoxy(51,29);
clear(51,29);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,32);
cin>>sal.emp_sal;
int ch=sal.emp_sal;
if (ch== 0 )
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(51,32);
clear(51,32);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,35);
gets(sal.pdate);
char ch=strlen(sal.pdate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,35);
clear(51,35);
}
}while(!valid);
salary_save();//calling of salary_save function
fin.clear();
getch();
}//end of function definition
/*starting of salary_show function definition body*/
void salary::salary_show()
{
clrscr();
int sno=1;
gotoxy(22,2);
textcolor(RED);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(17,4);
cprintf("Sallary Details For Administrative Purpose");
textcolor(WHITE);
gotoxy(2,7);
cout<<"--------------------------------------------------------
-------------------";
gotoxy(3,8);
textcolor(BLUE);
cprintf("SR.");
gotoxy(10,8);
cprintf("Job_Code");
gotoxy(21,8);
cprintf("Department");
gotoxy(42,8);
cprintf("Mode");
gotoxy(55,8);
cprintf("Salary");
gotoxy(65,8);
cprintf("Date_of_Pay");
textcolor(WHITE);
gotoxy(2,9);
cout<<"--------------------------------------------------------
-------------------";
int m=11;
fin.seekg(0,ios::beg);
while(fin.read((char*)&sal,sizeof(sal))!=0)
{
gotoxy(4,m);
cout<<sno;
gotoxy(10,m);
cout<<sal.emp_jcode;
gotoxy(21,m);
cout<<strupr(sal.emp_dep);
gotoxy(42,m);
cout<<strupr(sal.mode);
gotoxy(55,m);
cout<<sal.emp_sal;
gotoxy(65,m);
cout<<strupr(sal.pdate);
m++;
sno++;
}
textcolor(WHITE);
fin.clear();
}//end of salary_show function
/*starring of salary_del function definition body*/
void salary::salary_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(22,10);
cprintf("\nSALARY DETAILS OF ADMINISTRATIVE PURPOSE");
textcolor(WHITE);
screen4();
int code;
fin1.open("temp2.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Emp_Jcode To be Deleted:");
cin>>code;
fin.seekg(0,ios::beg);
int found=0;
while(fin.read((char*)&sal,sizeof(sal)))
{
if(sal.emp_jcode!=code)
fin1.write((char*)&sal,sizeof(sal));
else
found=1;
}
if(found==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found==1)
{
fin.close();
fin1.close();
remove("salary3.dat");
rename("temp2.dat","salary3.dat");
fin.open("salary3.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
fin.clear();
fin1.clear();
}//end of function definition
/*starting of salary_modify function definition*/
void salary::salary_modify()
{
int valid;
clrscr();
int jcode;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nSALARY DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter The Emp_jcode To be Modified:");//modifying
through emp_jcode
cin>>jcode;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&sal,sizeof(sal)))
{
if(sal.emp_jcode!=jcode)
count++;
else
{
scoot();
textcolor(GREEN);
gotoxy(12,21);
cprintf("Old Value");

gotoxy(12,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Job Code :");cout<<sal.emp_jcode;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,26);
cprintf("Department :");cout<<sal.emp_dep;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Mode of Payment:");cout<<sal.mode;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,32);
cprintf("Salary :");cout<<sal.emp_sal;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,35);
cprintf("Date of Payment:");cout<<sal.pdate;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(47,21);
cprintf("Enter New Value");
gotoxy(47,22);
cout<<"---------------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Enter Job_code :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,23);
cin>>sal.emp_jcode;
int ch=sal.emp_jcode;
if (ch== 0)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(56,23);
clear3(56,23);
}
}while(!valid);
gotoxy(40,26);
textcolor(CYAN);
cprintf("Department Name:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,26);
gets(sal.emp_dep);
char ch=strlen(sal.emp_dep);
if (ch== 0 || ch>=16)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,26);
clear3(56,26);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Mode of Payment:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,29);
gets(sal.mode);
char ch=strlen(sal.mode);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,29);
clear3(56,29);
}
}while(!valid);
gotoxy(40,32);
textcolor(CYAN);
cprintf("Enter Salary :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,32);
cin>>sal.emp_sal;
int ch=sal.emp_sal;
if (ch== 0 )
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";

getch();
clear3(40,38);
gotoxy(56,32);
clear3(56,32);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("Date of Payment:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,35);
gets(sal.pdate);
char ch=strlen(sal.pdate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,35);
clear3(56,35);
}
}while(!valid);
pos=count*sizeof(sal);
char ch;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&sal,sizeof(sal));
gotoxy(45,38);
cout<<"Salary Details modified....";
gotoxy(73,38);
fin.clear();
return;
}
else
return;
}
}
if(pos==0)//if record is not found
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of salary_modify function definition
/*starting of salary-query function definition*/
void salary::salary_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nSALARY DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Jcode of Employee To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&sal,sizeof(sal))!=0)
{
if(sal.emp_jcode!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen4();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nSALARY DETAILS");
textcolor(WHITE);
gotoxy(27,16);
cout<<"Quried Employee Jcode:"<<vac;
gotoxy(20,22);
cout<<"Job Code :";
gotoxy(20,24);
cout<<"Department name :";
gotoxy(20,26);
cout<<"Mode :";
gotoxy(20,28);
cout<<"Salary :";
gotoxy(20,30);
cout<<"Date_of_Pay :";
fin.seekg(0,ios::beg);
gotoxy(41,22);
cout<<sal.emp_jcode;
gotoxy(41,24);
cout<<strupr(sal.emp_dep);
gotoxy(41,26);
cout<<strupr(sal.mode);
gotoxy(41,28);
cout<<sal.emp_sal;
gotoxy(41,30);
cout<<strupr(sal.pdate);
s++;
if (sal.emp_jcode==vac)
{

return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function definition
/*--------------------------End of Salary
Class----------------------------*/
End of salary class coding.

Starting of employee class coding:

/*----------------------------Starting of employee
class-------------------*/
class employee//declaration of employee class
{
protected:
fstream fin,fin1;//fstream object
struct employee1//structure definition of data with data
types
{
int jcode;
char jdate[12];
char ename[15];
char fname[15];
char add[15];
char des[10];
char sex[2];
}elo;//end of structure declaration
public:
employee()//declaration of constructor
{
fin.open("employee.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit10();
}
elo.jcode=1000;//initialization of jcode
}
~employee()//declaration of destructor
{
fin.close();//closing of file
delete
elo.ename,elo.fname,elo.add,elo.des,elo.sex;//deletion of
structure data explicitly
}
/*starting of function declaration*/
void employee_menu();
void employee_entry();
void employee_details();
void employee_modify();
void employee_del();
void employee_query();
void employee_save();
void exit10();
/*end of function declaration*/
};//end of class declaration
/*starting of menu function*/
void employee::employee_menu()
{
emplo:
clrscr();

char ek;
screen3();
gotoxy(30,15);
textcolor(CYAN);
cprintf("EMPLOYEE DEPARTMENT");
gotoxy(27,17);
cprintf("EMPLOYEE DIVISION SUBMENU");
textcolor(WHITE);
screen1();
textcolor(GREEN);
gotoxy(23,21);
cprintf("[1] Entry of employee Details");//for details entry
gotoxy(23,24);
cprintf("[2] Employee Details");//for details and report
generation
gotoxy(23,27);
cprintf("[3] Modify of Details");//for modify details
gotoxy(23,30);
cprintf("[4] Deletion of details");//for deletion of details
gotoxy(23,33);
cprintf("[5] Query for Employee");//for details query
gotoxy(23,36);
cprintf("[6] Return to Employee Department Menu");
textcolor(YELLOW+BLINK);
gotoxy(32,38);
cprintf("Enter Your choice:");
textcolor(WHITE);
ek=getch();
switch(ek)
{
case '1'://calling of employee_entry function
clrscr();
employee_entry();
eko:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char ek1;
cin>>ek1;
switch(ek1)
{
case '1'://for more entry
employee_entry();
goto eko;
case '2':
goto emplo;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto eko;
}
case '2'://calling of employee_details function
employee er1;
clrscr();
er1.employee_details();
fin.clear();
getch();
goto emplo;
case'3'://calling of employee_modify function
employee er2;
clrscr();
er2.employee_modify();
getch();
goto emplo;
case'4'://calling of employee_del function
employee er3;
clrscr();
er3.employee_del();
getch();
goto emplo;
case'5'://calling of employee_query function
employee er4;
clrscr();
er4.employee_query();
getch();
goto emplo;
case'6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto emplo;
}
}//end of menu function
/*starting of employee_save function body*/
void employee::employee_save()
{
char in;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&elo,sizeof(elo));
gotoxy(23,37);
cout<<"Employee Details Entered.....";
elo.jcode++;//incrementation of jcode
clear(25,42);
gotoxy(50,37);
fin.clear();
}
else
gotoxy(56,42);
return;
}//end of function body
void employee::exit10()//function for error handling
{
fin.close();
}
/*starting of employe_entry function body*/
void employee::employee_entry()
{
int valid;
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nEMPLOYEE DEATILS");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,22);
cprintf("Emploee Job_code :");
gotoxy(18,24);
cprintf("Enter The Join_Date :");
gotoxy(18,26);
cprintf("Enter The Name :");
gotoxy(18,28);
cprintf("Enter The Father's Name :");
gotoxy(18,30);
cprintf("Enter The Address :");
gotoxy(18,32);
cprintf("Enter The Designation :");
gotoxy(18,34);
cprintf("Enter The Sex(M/F) :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(48,22);
cout<<elo.jcode;
do
{
valid=1;
gotoxy(48,24);
gets(elo.jdate);
char ch=strlen(elo.jdate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,24);
clear(48,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(48,26);
gets(elo.ename);
char ch=strlen(elo.ename);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,26);
clear(48,26);
}
}while(!valid);
do
{
valid=1;

gotoxy(48,28);
gets(elo.fname);
char ch=strlen(elo.fname);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,28);
clear(48,28);
}
}while(!valid);
do
{
valid=1;
gotoxy(48,30);
gets(elo.add);
char ch=strlen(elo.add);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,30);
clear(48,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(48,32);
gets(elo.des);
char ch=strlen(elo.des);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,32);
clear(48,32);
}
}while(!valid);
do
{
valid=1;
gotoxy(48,34);
gets(elo.sex);
char ch=strlen(elo.sex);
if (ch== 0 || ch>=2)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,34);
clear(48,34);
}
}while(!valid);
employee_save();//calling of save function
fin.clear();
getch();
}//end of function body
/*starting of employee_details function*/
void employee::employee_details()
{
clrscr();
textcolor(RED);
int m=10;
gotoxy(22,2);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");//<<endl;
gotoxy(28,4);
cprintf("Employee Details");
textcolor(WHITE);
gotoxy(2,6);
cprintf("------------------------------------------------------
-------------------------");
textcolor(BLUE);
gotoxy(2,7);
cprintf("E_jcode");
gotoxy(10,7);
cprintf("J_date");
gotoxy(21,7);
cprintf("Name");
gotoxy(37,7);
cprintf("F_name");
gotoxy(53,7);
cprintf("Adderess");
gotoxy(66,7);
cprintf("Designation");
gotoxy(78,7);
cprintf("Sex");
textcolor(WHITE);
gotoxy(2,8);
cout<<"--------------------------------------------------------
-----------------------";
textcolor(WHITE);
fin.seekg(0,ios::beg);
while(fin.read((char*)&elo,sizeof(elo))!=0)
{
gotoxy(2,m);
cout<<elo.jcode;
gotoxy(9,m);
cout<<strupr(elo.jdate);
gotoxy(21,m);
cout<<strupr(elo.ename);
gotoxy(37,m);
cout<<strupr(elo.fname);
gotoxy(53,m);
cout<<strupr(elo.add);
gotoxy(67,m);
cout<<strupr(elo.des);
gotoxy(79,m);
cout<<strupr(elo.sex);
m++;
}
fin.clear();
}//end of function body
/*starting of employee_modify function*/
void employee::employee_modify()
{
clrscr();

int number1,valid;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nEMPLOYEE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter The Emp_jcode To be Modified:");
cin>>number1;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&elo,sizeof(elo)))
{
if(elo.jcode!=number1)
count++;
else
{
int ck;
/*Displaying of old value of reference*/
scoot();
textcolor(GREEN);
gotoxy(12,21);
cprintf("Old Value");
gotoxy(12,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Emp_jcode :");cout<<elo.jcode;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,25);
cprintf("Join Date :");cout<<elo.jdate;
textcolor(WHITE);
textcolor(CYAN);

gotoxy(5,27);
cprintf("Name :");cout<<elo.ename;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Father's Name :");cout<<elo.fname;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,31);
cprintf("Address :");cout<<elo.add;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,33);
cprintf("Designation :");cout<<elo.des;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,35);
cprintf("Sex :");cout<<elo.sex;
textcolor(WHITE);
/*Entering of new value*/
scoot1();
textcolor(GREEN);
gotoxy(47,21);
cprintf("Enter New Value");
gotoxy(47,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Job code :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,23);
cin>>elo.jcode;
ck=elo.jcode;
if(ck!=number1)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Make Duplicate entry";
getch();
clear3(40,38);
gotoxy(56,23);
clear3(56,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Join_date :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,25);
gets(elo.jdate);
char ch=strlen(elo.jdate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
textcolor(CYAN);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,25);
clear3(56,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("Enter The Name :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,27);
gets(elo.ename);
char ch=strlen(elo.ename);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,27);
clear3(56,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Father's Name :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,29);
gets(elo.fname);
char ch=strlen(elo.fname);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,29);
clear3(56,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("Enter Address :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,31);
gets(elo.add);
char ch=strlen(elo.add);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,31);
clear3(56,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("The Designation:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,33);
gets(elo.des);
char ch=strlen(elo.des);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,33);
clear3(56,33);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("Enter The Sex :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,35);
gets(elo.sex);
char ch=strlen(elo.sex);
if (ch== 0 || ch>=2)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,35);
clear3(56,35);
}
}while(!valid);
pos=count*sizeof(elo);
char ch;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&elo,sizeof(elo));
gotoxy(45,38);
cout<<"Employee Details modified....";
gotoxy(76,38);
return;
}
else
return;
}
}
if(pos==0)
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of function body
/*starting of employee_del function body*/
void employee::employee_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(33,10);
cprintf("\nEMPLOYEE DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("temk.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Emp_jcode To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&elo,sizeof(elo)))
{
if(elo.jcode!=code1)
fin1.write((char*)&elo,sizeof(elo));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("employee.dat");
rename("temk.dat","employee.dat");
fin.open("employee.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
}//end of function body
/*starting of employee_query function body*/
void employee::employee_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nEMPLOYEE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Employee Jcode To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&elo,sizeof(elo))!=0)
{
if(elo.jcode!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nEMPLOYEE DETAILS");
textcolor(WHITE);
gotoxy(27,16);
cout<<"Quried Employee Jcode:"<<vac;
gotoxy(20,22);
textcolor(CYAN);
cprintf("Employee Jcode :");
gotoxy(20,24);
cprintf("Joining_date :");
gotoxy(20,26);
cprintf("Name of Employee :");
gotoxy(20,28);
cprintf("Father's name :");
gotoxy(20,30);
cprintf("Address :");
gotoxy(20,32);
cprintf("Designation :");
gotoxy(20,34);
cprintf("Sex :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(44,22);
cout<<elo.jcode;
gotoxy(44,24);
cout<<strupr(elo.jdate);
gotoxy(44,26);
cout<<strupr(elo.ename);
gotoxy(44,28);
cout<<strupr(elo.fname);
gotoxy(44,30);
cout<<strupr(elo.add);
gotoxy(44,32);
cout<<strupr(elo.des);
gotoxy(44,34);
cout<<strupr(elo.sex);
s++;
if (elo.jcode==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function body
/*--------------------------End of Employee
Class-------------------------*/
End of Employee class coding

Starting of income class coding:

/*------------------------Starting of income
class-----------------------*/
class income//declaration of income class
{
protected:
struct//structure declaration for data with their data
type
{
int sno;
char edate[15];
char dep[16];
int jcode;
char mode[10];
int year;
float amount;
char pay[5];
}ins;//end of structure declaration
fstream fin,fin1;//declaration of fstream variable
public:
income()//constructor declaration
{
fin.open("income.dat",ios::in|ios::out|ios::binary|
ios::ate);
if (!fin)//for error/exception handling
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit1();
}
}
~income()//destructor declaration
{
fin.close();
delete ins.edate,ins.dep,ins.mode,ins.pay;//deletion
of structure data explicitly
}
/*starting of function declaration*/
void income_entry();
void income_show();
void income_menu();
void income_query();
void income_save();
void exit1();
/*end of function declaration*/
};//end of class declaration
/*starting of menu function body*/
void income::income_menu()
{
again1:
char ch2;
clrscr();
screen3();
gotoxy(18,15);
textcolor(CYAN);
cprintf("Account Division of Administrative Department");
gotoxy(31,17);
cprintf("Income Division");
screen4();
textcolor(GREEN);
gotoxy(25,20);
cprintf("[1] Income Entry");//for income entry
gotoxy(25,23);
cprintf("[2] Income Details");//for details/report generation
gotoxy(25,26);
cprintf("[3] Query For Income details");//query for details
gotoxy(25,29);
cprintf("[4] Return To Account Division Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,31);
cprintf("Enter Your Choice:");
textcolor(WHITE);
ch2=getch();
switch(ch2)
{
case '1'://calling of income_entry function
clrscr();
income_entry();
repea1:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char more1;
cin>>more1;
switch(more1)
{
case '1'://for more entry
income_entry();
goto repea1;
case '2':
goto again1;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto repea1;
}
case '2'://calling of income_show function
income i;

i.income_show();
getch();
goto again1;
case '3'://calling of income_query function
income i1;
i1.income_query();
getch();
goto again1;
case '4':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto again1;
}
}//end of menu function body
/*starting of income_save function body defination*/
void income::income_save()
{
char in;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&ins,sizeof(ins));
gotoxy(23,38);
cout<<"Income Details Entered.....";
clear(25,42);
gotoxy(52,38);
}
else
gotoxy(56,42);
return;
}//end of save function declaration
void income::exit1()
{
fin.close();
}
/*starting of income_entry function*/
void income::income_entry()
{
int valid;
clrscr();
screen2();
screen1();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(33,10);
cprintf("\nINCOME DETAILS");
textcolor(WHITE);
gotoxy(20,22);
textcolor(CYAN);
cprintf("Enter The Date :");
gotoxy(20,24);
cprintf("Enter The Department Name :");
gotoxy(20,26);
cprintf("Enter The Head Job_code :");
gotoxy(20,28);
cprintf("Enter The Income Mode :");
gotoxy(20,30);
cprintf("Enter The Year :");
gotoxy(20,32);
cprintf("Enter The Total Income :");
gotoxy(20,34);
cprintf("Payment :");
textcolor(WHITE);
fin.seekp(0,ios::end);
do
{
valid=1;
gotoxy(51,22);
gets(ins.edate);
char ch=strlen(ins.edate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,22);
clear(51,22);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,24);
gets(ins.dep);
char ch=strlen(ins.dep);
if (ch== 0 || ch>=16)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,24);
clear(51,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,26);
cin>>ins.jcode;
int ch=ins.jcode;
if (ch== 0 )
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(51,26);
clear(51,26);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,28);
gets(ins.mode);
char ch=strlen(ins.mode);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,28);
clear(51,28);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,30);
cin>>ins.year;
int ch=ins.year;
if (ch== 0 )
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(51,30);
clear(51,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,32);
cin>>ins.amount;
int ch=ins.amount;
if (ch== 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,32);
clear(51,32);
}
}while(!valid);
do
{
valid=1;
gotoxy(51,34);
gets(ins.pay);
char ch=strlen(ins.pay);
if (ch== 0 || ch>=4)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(51,34);
clear(51,34);
}
}while(!valid);
income_save();
getch();
}//end of function body
/* starting of income_show function body*/
void income::income_show()
{
clrscr();
int sno=1;
int rno=100;
gotoxy(22,3);
textcolor(RED);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(29,5);
cprintf("Income Details");
textcolor(WHITE);
gotoxy(2,7);
cout<<"--------------------------------------------------------
----------------------";
gotoxy(2,8);
textcolor(BLUE);
cprintf("SR.");
gotoxy(6,8);
cprintf("Date");
gotoxy(18,8);
cprintf("Department");
gotoxy(35,8);
cprintf("Jcode");
gotoxy(45,8);
cprintf("Mode");
gotoxy(54,8);
cprintf("Year");
gotoxy(62,8);
cprintf("Income");
gotoxy(72,8);
cprintf("Payment");
textcolor(WHITE);
gotoxy(2,9);
cout<<"--------------------------------------------------------
----------------------";
int m=11;
fin.seekg(0,ios::beg);
while(fin.read((char*)&ins,sizeof(ins))!=0)
{
gotoxy(2,m);
cout<<sno;
gotoxy(6,m);
cout<<strupr(ins.edate);
gotoxy(18,m);
cout<<strupr(ins.dep);
gotoxy(35,m);
cout<<ins.jcode;
gotoxy(45,m);
cout<<strupr(ins.mode);
gotoxy(54,m);
cout<<ins.year;
gotoxy(62,m);
cout<<ins.amount;
gotoxy(74,m);
cout<<strupr(ins.pay);
m++;
sno++;
rno++;
}
textcolor(WHITE);
}//end of function body
/*starting of income_query function body*/
void income::income_query()
{
clrscr();
int vac_no;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nINCOME DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter Eployee Jcode To Make Query:");
cin>>vac_no;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&ins,sizeof(ins))!=0)
{
if(ins.jcode!=vac_no)
co++;
else
{
clrscr();
int s=1;
screen2();

screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nEMPLOYEE DETAILS");
textcolor(WHITE);
gotoxy(27,16);
cout<<"Quried Head_Jcode:"<<vac_no;
gotoxy(20,22);
textcolor(CYAN);
cprintf("Head_jcode :");
gotoxy(20,24);
cprintf("Date :");
gotoxy(20,26);
cprintf("Department name :");
gotoxy(20,28);
cprintf("Income Mode :");
gotoxy(20,30);
cprintf("Year :");
gotoxy(20,32);
cprintf("Total Income :");
gotoxy(20,34);
cprintf("Payment :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(42,22);
cout<<ins.jcode;
gotoxy(42,24);
cout<<strupr(ins.edate);
gotoxy(42,26);
cout<<strupr(ins.dep);
gotoxy(42,28);
cout<<strupr(ins.mode);
gotoxy(42,30);
cout<<ins.year;
gotoxy(42,32);
cout<<ins.amount;
gotoxy(42,34);
cout<<strupr(ins.pay);
s++;
if (ins.jcode==vac_no)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function body
/*---------------------End of The Income
Class----------------------*/
End of income class coding.

Starting of recruitment class coding:

/*-----------------------Starting of recruitment
class-------------------*/
class recruitment//class declaration
{
protected:
/*starting of struct declaration for data with their data
types*/
struct recruitment1
{
int snum;
char edate[15];
int seat;
char post[10];
float amount;
char ldate[15];
}hum;//end of struct declaration
fstream fin,fin1;//declaration of fstream variable
public:
recruitment()//constructor declaration
{
fin.open("recruitment.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable To open File";
getch();
exit4();
}
hum.snum=200;//intialization of vaccency number
}
~recruitment()//declaration of destructor
{
fin.close();//closing of file stram
delete hum.edate,hum.post,hum.ldate;//deletion of struct
data explicitly
}
/*starting of function declaration*/
void recruitment_entry(void);
void recruitment_display(void);
void recruitment_del(void);
void recruitment_modify(void);
void recruitment_menu();
void recruitment_query();
void recruitment_save();
void exit4();
/*end of function declaration*/
};//end of class declaration
/*starting of menu function body*/
void recruitment::recruitment_menu()
{
all:
char ch;
clrscr();
screen3();
gotoxy(28,15);
textcolor(CYAN);
cprintf("ADMINISTRATIVE DEPARTMENT");
gotoxy(27,17);
cprintf("EMPLOYEE RECRUITMENT DIVISION");
screen1();
textcolor(GREEN);
gotoxy(23,21);
cprintf("[1] Entry of Details");//for entry of details
gotoxy(23,24);
cprintf("[2] Recruitment Details");//for showing and report
generation
gotoxy(23,27);
cprintf("[3] Deletion of Details");//for deletion of details
gotoxy(23,30);
cprintf("[4] Modification of Details");//for modifying of
deatails
gotoxy(23,33);
cprintf("[5] Query for Details");//for query related to data
gotoxy(23,36);
cprintf("[6] Return to Administrative Menu");
textcolor(YELLOW+BLINK);
gotoxy(32,38);
cprintf("Enter Your choice:");
textcolor(WHITE);
ch=getch();
switch(ch)
{
case '1'://calling of recruitment_entry function
clrscr();
recruitment_entry();
repea:
gotoxy(21,41);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,42);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2) :");
textcolor(WHITE);
char more;
cin>>more;
switch(more)
{
case '1'://for more entry
recruitment_entry();
flush(fin);
goto repea;
case '2':
goto all;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto repea;
}
case '2'://calling of recruitment_dispaly function
recruitment rom;
clrscr();
rom.recruitment_display();
fin.clear();
getch();
goto all;
case '3'://calling of recruitment_del function
recruitment rom1;
clrscr();
rom1.recruitment_del();
fin.clear();
fin1.clear();
getch();
goto all;
case '4'://calling of rcruitment_modify function
recruitment rom2;
rom2.recruitment_modify();
flush(fin);
getch();
goto all;
case '5'://calling of recruitment_query function
recruitment rom3;
rom3.recruitment_query();
getch();
goto all;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto all;
}
}//end of menu function definiion
/*starting of recruitment_save function definition body*/
void recruitment::recruitment_save()
{
char in;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&hum,sizeof(hum));
gotoxy(23,38);
cout<<"Budget Details Entered.....";
hum.snum++;//incrementation of vaccency number
clear(25,42);
gotoxy(52,38);
}
else
gotoxy(56,42);
return;
}//end of save function definition
void recruitment::exit4()
{
fin.close();
}
/*starting of recruitment_entry function body definition*/
void recruitment::recruitment_entry(void)
{
int valid;
clrscr();
screen2();
screen1();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nRECRUITMENT DETAILS");
textcolor(WHITE);
gotoxy(20,22);
textcolor(CYAN);
cprintf("Enter The Vaccency Number :");
gotoxy(20,24);
cprintf("Enter The Date of Entry :");
gotoxy(20,26);
cprintf("Enter The Number_of_Vacent Seats:");
gotoxy(20,28);
cprintf("Enter The Name_of_Post :");
gotoxy(20,30);
cprintf("Enter The Pay Scale :");
gotoxy(20,32);
cprintf("Last Date_of Applicatin receipt :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(54,22);
cout<<hum.snum;//displaying automatically through constructor
do
{
valid=1;
gotoxy(54,24);
gets(hum.edate);
char ch=strlen(hum.edate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(54,24);
clear(54,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(54,26);
cin>>hum.seat;
if (hum.seat==0)
{
valid=0;
gotoxy(18,36);
cprintf("Seat Entry Should Not be Zero ");
getch();
clear(18,36);
}
}while(!valid);
do
{
valid=1;
gotoxy(54,28);
gets(hum.post);
char ch=strlen(hum.post);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(54,28);
clear(54,28);
}
}while(!valid);
do
{
valid=1;
gotoxy(54,30);
cin>>hum.amount;
float ch=hum.amount;
if (ch== 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(54,30);
clear(54,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(54,32);
gets(hum.ldate);
char ch=strlen(hum.ldate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(54,32);
clear(54,32);
}
}while(!valid);
recruitment_save();//calling of recruitment_save function for
user need
fin.clear();
getch();
}//end of function definition
/*starting of recruitment_display function definition*/
void recruitment::recruitment_display(void)
{
clrscr();
int sno=1;
int rno=100;
gotoxy(22,2);
textcolor(RED);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(28,4);
cprintf("Recruitment Details");
textcolor(WHITE);
gotoxy(2,7);
cout<<"--------------------------------------------------------
-------------------";
gotoxy(3,8);
textcolor(BLUE);
cprintf("SR.");
gotoxy(8,8);
cprintf("Vac.No#");
gotoxy(16,8);
cprintf("Entry_date");
gotoxy(28,8);
cprintf("Vacent_Seats");
gotoxy(43,8);
cprintf("Name_of_Post");
gotoxy(58,8);
cprintf("pay");
gotoxy(67,8);
cprintf("last_date");
textcolor(WHITE);
gotoxy(2,9);
cout<<"--------------------------------------------------------
-------------------";
int m=10;
fin.seekg(0,ios::beg);
while(fin.read((char*)&hum,sizeof(hum))!=0)
{
gotoxy(4,m);
cout<<sno;
gotoxy(8,m);
cout<<hum.snum;
gotoxy(16,m);
cout<<strupr(hum.edate);
gotoxy(33,m);
cout<<hum.seat;
gotoxy(43,m);
cout<<strupr(hum.post);
gotoxy(58,m);
cout<<hum.amount;
gotoxy(67,m);
cout<<strupr(hum.ldate);
m++;
sno++;
rno++;
}
textcolor(WHITE);
fin.clear();
}//end of function definition
/*strting of recruitment_del function defintion*/
void recruitment::recruitment_del(void)
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\nEMPLOYEE RECRUITMENT DETAILS");
textcolor(WHITE);
screen4();
int number1;
fin1.open("kal.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Vaccency No. To be Deleted:");
cin>>number1;
fin.seekg(0,ios::beg);
int found=0;
while(fin.read((char*)&hum,sizeof(hum)))
{
if(hum.snum!=number1)
fin1.write((char*)&hum,sizeof(hum));
else
found=1;
}
if(found==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found==1)
{
fin.close();
fin1.close();
remove("recruitment.dat");
rename("kal.dat","recruitment.dat");
fin.open("recruitment.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
getch();
}
fin.clear();
fin1.clear();
}//end of function definition
/*starting of recruitent_modify function definition*/
void recruitment::recruitment_modify(void)
{
int valid;
clrscr();
int vaccency_no;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nRECRUITMENT DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Vaccency No. To be Modified:");
cin>>vaccency_no;
clear(20,22);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&hum,sizeof(hum)))
{
if(hum.snum!=vaccency_no)
count++;
else
{
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,24);
cprintf("Vacancey Number :");cout<<hum.snum;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,26);
cprintf("Date of Entry :");cout<<hum.edate;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,28);
cprintf("Vacent Seat :");cout<<hum.seat;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,30);
cprintf("Name of Seat :");cout<<hum.post;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,32);
cprintf("Pay Scale :");cout<<hum.amount;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,34);
cprintf("Last Date :");cout<<hum.ldate;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,24);
textcolor(CYAN);
cprintf("The Vaccency No :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,24);
cin>>hum.snum;
int ck=hum.snum;
if(ck!=vaccency_no)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Make Duplicate entry";
getch();
clear3(40,38);
gotoxy(57,24);
clear3(57,24);
}
}while(!valid);
gotoxy(40,26);
textcolor(CYAN);
cprintf("Date_of_Entry :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,26);
gets(hum.edate);
char ch=strlen(hum.edate);
if (ch== 0 || ch>=15)
{
valid=0;

gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,27);
clear3(57,27);
}
}while(!valid);
gotoxy(40,28);
textcolor(CYAN);
cprintf("Vacent Seat :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,28);
cin>>hum.seat;
if (hum.seat==0)
{
valid=0;
gotoxy(40,36);
cprintf("Seat Entry Should Not be Zero ");
getch();
clear3(40,36);
}
}while(!valid);
gotoxy(40,30);
textcolor(CYAN);
cprintf("The Name_of_Post:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,30);
gets(hum.post);
char ch=strlen(hum.post);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,30);
clear3(57,30);
}
}while(!valid);
gotoxy(40,32);
textcolor(CYAN);
cprintf("The Pay Scale :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,32);
cin>>hum.amount;
float ch=hum.amount;
if (ch== 0)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";
getch();
clear3(18,38);
gotoxy(57,32);
clear3(57,32);
}
}while(!valid);
gotoxy(40,34);
textcolor(CYAN);
cprintf("Last Date :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,34);
gets(hum.ldate);
char ch=strlen(hum.ldate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,34);
clear3(57,34);
}
}while(!valid);
pos=count*sizeof(hum);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
char ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&hum,sizeof(hum));
gotoxy(42,38);
cout<<"Recruitment Details modified....";
gotoxy(73,38);
fin.clear();
return;
}
else
return;
}
}
if(pos==0)//if record is not found
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of function body
/*starting of recruitment_query function definition*/
void recruitment:: recruitment_query()
{
clrscr();
int vac_no;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(29,10);
cprintf("\nRECRUITMENT DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Vaccency No. To Make Query:");
cin>>vac_no;
clear1();
int co=0;

fin.seekg(0,ios::beg);
while(fin.read((char*)&hum,sizeof(hum))!=0)
{
if(hum.snum!=vac_no)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nRECRUITMENT DETAILS");
textcolor(WHITE);
gotoxy(24,16);
cout<<"Quried Vaccency Number:"<<vac_no;
gotoxy(20,22);
textcolor(CYAN);
cprintf("Serial Number :");
gotoxy(20,24);
cprintf("Vaccency Number :");
gotoxy(20,26);
cprintf("Date of Entry :");
gotoxy(20,28);
cprintf("Number_of_Vacent Seats :");
gotoxy(20,30);
cprintf("Name_of_Post :");
gotoxy(20,32);
cprintf("Pay Scale :");
gotoxy(20,34);
cprintf("Last Date_of App_receipt:");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(45,22);
cout<<s;
gotoxy(45,24);
cout<<hum.snum;
gotoxy(45,26);
cout<<strupr(hum.edate);
gotoxy(45,28);
cout<<hum.seat;
gotoxy(45,30);
cout<<strupr(hum.post);
gotoxy(45,32);
cout<<hum.amount;
gotoxy(45,34);
cout<<strupr(hum.ldate);
s++;
if (hum.snum==vac_no)
{
return;
}
textcolor(WHITE);
fin.clear();
}
}
if(co==0)//if record is not found
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function definition
/*---------------------End of Recruitment
Class--------------------*/
End of recruitment class coding.

 Marketing Module Coding:

Starting of market class coding:

/*----------------------------including of classes for


Inheritence------------*/
#include"d:\gaurav\purchase.cpp"
#include"d:\gaurav\lease.cpp"
#include"d:\gaurav\expense.cpp"
/*----------------------------End of
including--------------------------------*/
/*------------------------Starting of market class for creation
of menu for Marketing Department----------------------*/
class market:public purchase,expense,lease//class declaration and
inheritence of purchase,lease,expense
{
public:
void make();//declaration of function for creation of menu
for marketing department
};//end of class declaration
/*--------------------definition of make function
body------------------------*/
void market::make()
{
abc1:
clrscr();
screen();
char first1;
screen();
gotoxy(30,16);
cout<<"MARKETING DEPARTMENT MENU";
screen1();
textcolor(5);
gotoxy(24,22);
cprintf(" 1. PURCHASE ORDER DIVISION");//calling of purchase
division
gotoxy(24,25);
cprintf(" 2. LEASE DIVISION");//calling of lease section
gotoxy(24,28);
cprintf(" 3. EXPENSES DETAILS DIVISION");//calling of expense
division
gotoxy(24,31);
cprintf(" 4. REPORT");//for report generation
gotoxy(24,34);
cprintf(" 5. HELP");//help for user related to choices
gotoxy(24,37);
cprintf(" 6. RETURN TO MAIN");//return tomain menu
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
gotoxy(43,38);
first1=getch();
switch(first1)
{
case '1'://calling of purchase menu function from purchase
class
clrscr();
//purchase pum;
purchase::purchase_menu();
goto abc1;
case '2'://calling of lease menu function from lease class
clrscr();
lease lov;
lov.lease_menu();
goto abc1;
case '3'://calling of expense menu function from expense
class
clrscr();
//expense expo;
expense::expense_menu();
goto abc1;
case '4'://calling for report generation
marketo1:
clrscr();
char muk6;
screen2();
textcolor(RED);
cprintf("\nREPORT MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(30,10);
cprintf("\nMARKETING DEPARTMENT");
textcolor(WHITE);
screen4();
gotoxy(23,22);
textcolor(11);
cprintf("1.Purchase Order Report");
gotoxy(23,24);
cprintf("2.Lease Report");
gotoxy(23,26);
cprintf("3.Expenses Report");
gotoxy(23,28);
cprintf("4.Return To Marketing Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,31);
cprintf("Enter Your Choice:");
textcolor(WHITE);
muk6=getch();
switch(muk6)
{
case '1'://report generation for purchase division
clrscr();
purchase pr;
pr.purchase_details();
getch();
goto marketo1;
case '2'://report generation for lease division
clrscr();
lease les;
les.lease_details();
getch();
goto marketo1;
case '3'://report generation for expense division
clrscr();
expense expu;
expu.expense_details();
getch();
goto marketo1;
case '4':
goto abc1;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto marketo1;
}
case '5'://calling for help generation
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(31,10);
cprintf("\nMARKETING DEPARTMENT");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(15,16);
cprintf("IF CHOICE:1# ");
gotoxy(21,17);
textcolor(11);
cprintf("The User can work with the Purchase
Divisin.");
gotoxy(16,19);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,20);
textcolor(11);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,21);
cprintf("Details of Purchase Order.");
textcolor(RED);
gotoxy(15,23);
cprintf("IF CHOICE:2# ");
textcolor(11);
gotoxy(21,24);
cprintf("The User can Work with the Lease Division.");
gotoxy(16,26);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,27);
textcolor(11);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,28);
cprintf("Details of Lease Details.");
textcolor(RED);
gotoxy(15,30);
cprintf("IF CHOICE:3# ");
textcolor(11);
gotoxy(21,31);
cprintf("The User Can Work with the Expenses
Division.");
gotoxy(16,33);
textcolor(5);
cprintf("IF SUB CHOICE#");
gotoxy(21,34);
textcolor(11);
cprintf("The User Can make Entry and Display the
Details.");
gotoxy(15,36);
textcolor(RED);
cprintf("IF CHOICE:4# ");
gotoxy(21,37);
textcolor(11);
cprintf("User can Generate Report For all above
choices.");
gotoxy(18,39);
textcolor(5);
cprintf("Press Any Key To Continue........");
textcolor(WHITE);
getch();
goto abc1;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto abc1;
}

}
/*----------------------------End of market
class-----------------------------*/
End of market class coding.

Starting of purchase class coding:

/*------------------------------Starting of purchase
class-------------------*/
class purchase//class declaration
{
protected:
fstream fin,fin1;//declaration of fstream variable
/*starting of structure declaration of data with their
data types*/
struct purchase1
{
int order;
char vehicle[10];
float cost;
int emp_jcode;
char data[15];
}pur;//end of structure declaration
public:
purchase()//declaration of constructor
{
fin.open("purcase.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit5();
}

pur.order=10;//intialization of purchase order


}
~purchase()//declaration of destructor
{
fin.close();
delete pur.vehicle,pur.data;//deletion of structure
varable explicitly
}
/* starting of declaration of function*/
void purchase_entry();
void purchase_details();
void purchase_menu();
void purchase_query();
void purchase_save();
void exit5();
/*end of functin declaration*/
};//end of class declaration
/*starting of menu class defination*/
void purchase::purchase_menu()
{
market1:
clrscr();
char m1;
screen3();
gotoxy(18,15);
textcolor(CYAN);
cprintf("Purchase Division of Marketing Department");
gotoxy(27,17);
cprintf("purchase Order Submenu");
screen4();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Purchase Order Entry");//for entry of purchase
order
gotoxy(25,24);
cprintf("[2] Order Details");//for order details
gotoxy(25,27);
cprintf("[3] Query For Purchase Order");//for query of details
gotoxy(25,30);
cprintf("[4] Return To Purchase Division Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,32);
cprintf("Enter Your Choice:");
textcolor(WHITE);
m1=getch();
switch(m1)
{
case '1'://calling of purchase_entry function
clrscr();
purchase_entry();
rep:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char m2;
cin>>m2;
switch(m2)
{
case '1'://for more enrry
purchase_entry();
goto rep;
case '2':
goto market1;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
gotoxy(21,42);
goto rep;
}
case '2'://calling of purchase_details function
clrscr();
purchase po;
po.purchase_details();
fin.clear();
getch();
goto market1;
case'3'://calling of purchase_query function
purchase po1;
po1.purchase_query();
fin.clear();
getch();
goto market1;
case '4':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto market1;
}
}//end of menu function
/*starting of purchase_save function definition*/
void purchase::purchase_save()
{
char in;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&pur,sizeof(pur));
gotoxy(23,38);
cout<<"Purchase Details Entered.....";
pur.order++;//incrementatiuon of purchase order number
clear(25,42);
gotoxy(52,38);
}
else
gotoxy(56,42);
return;
}//end of function definition
void purchase::exit5()
{
fin.close();
}
/*starting of purchase_entry function definition*/
void purchase::purchase_entry()
{
int valid;
clrscr();
screen2();
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nPURCHASE ORDER");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,21);
cprintf("Number of Purchase Order :");
gotoxy(18,24);
cprintf("Enter The Name of Purchasable Thing :");
gotoxy(18,27);
cprintf("Enter The Date :");
gotoxy(18,30);
cprintf("Enter The Spended Cost :");
gotoxy(18,33);
cprintf("The Job_code of Responsible Employee :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(57,21);
cout<<pur.order;//dispalying of purchase order number through
constructor
/*error checking during data entry is strts from here*/
do
{
valid=1;
gotoxy(57,24);
gets(pur.vehicle);
char ch=strlen(pur.vehicle);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(57,24);
clear(57,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(57,27);
gets(pur.data);
char ch=strlen(pur.data);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(57,27);
clear(57,27);
}
}while(!valid);
do
{
valid=1;
gotoxy(57,30);
cin>>pur.cost;
int ch=pur.cost;
if (ch== 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(57,30);
clear(57,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(57,33);
cin>>pur.emp_jcode;
int ch=pur.emp_jcode;
if (ch== 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(57,30);
clear(57,30);
}
}while(!valid);
/*end of error checking*/
purchase_save();//calling of purchase_save function according
to user need
fin.clear();
getch();
}//end of function definition
/*starting of purchas_details function definition*/
void purchase::purchase_details()
{
clrscr();
int m=9;
gotoxy(22,2);
textcolor(RED);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(29,4);
cprintf("Purchase Oredr");
textcolor(WHITE);
gotoxy(2,6);
cout<<"--------------------------------------------------------
-----------------";
gotoxy(3,7);
textcolor(BLUE);
cprintf("Order No.");
gotoxy(15,7);
cprintf("Vehicle Name");
gotoxy(31,7);
cprintf("Date");
gotoxy(46,7);
cprintf("Total Amount");
gotoxy(65,7);
cprintf("Emp_Jcode");
textcolor(WHITE);
gotoxy(2,8);
cout<<"--------------------------------------------------------
-----------------";
fin.seekg(0,ios::beg);
while(fin.read((char*)&pur,sizeof(pur))!=0)
{
gotoxy(5,m);
cout<<pur.order;
gotoxy(15,m);
cout<<strupr(pur.vehicle);
gotoxy(31,m);
cout<<strupr(pur.data);
gotoxy(46,m);
cout<<pur.cost;
gotoxy(67,m);
cout<<pur.emp_jcode;
m++;
}
fin.clear();
}//end of function definition
/*strting of purchase_query function definition*/
void purchase::purchase_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\nPURCHASE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The order Number To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&pur,sizeof(pur))!=0)
{
if(pur.order!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen4();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(29,10);
cprintf("\nPURCHASE DETAILS");
textcolor(WHITE);
gotoxy(27,16);
cout<<"Quried Order Number:"<<vac;
gotoxy(20,22);
textcolor(CYAN);
cprintf("Order Number :");
gotoxy(20,24);
cprintf("Name of Thing :");
gotoxy(20,26);
cprintf("Date :");
gotoxy(20,28);
cprintf("Spended Cost :");
gotoxy(20,30);
cprintf("Job code :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(44,22);
cout<<pur.order;
gotoxy(44,24);
cout<<strupr(pur.vehicle);
gotoxy(44,26);
cout<<strupr(pur.data);
gotoxy(44,28);
cout<<pur.cost;
gotoxy(44,30);
cout<<pur.emp_jcode;
s++;
if (pur.order==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)//if record is not found
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function definition body
/*--------------------End of purchase class-----------------*/

End of purchase class coding.

Starting of lease class coding:


/*-----------------------starting of lease
class--------------------*/
class lease//declaratin of class
{
protected:
int valid;
char ch;
int ch1;
fstream fin ,fin1;//declaration of fstream variable
/*starting of struct declaration for dat with their data
types*/
struct lease1
{
long int lea_num;
char name[10];
char data[15];
char n_owner[15];
char add[15];
char mode[10];
float pay;
char num[12];
}lea;//end of struct declaration
public:
lease()//constuctor declaration
{
fin.open("lease6.dat",ios::in|ios::out|ios::binary|
ios::ate);
if (!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit8();
}
lea.lea_num=100;//initialization of lease number
}
~lease()//destructor declaration
{
fin.close();//closing of file object
delete
lea.name,lea.data,lea.n_owner,lea.add,lea.mode,lea.num;//deletion
of struct variable explicitly
}
/*starting of functtion declaration*/
void lease_entry();
void lease_details();
void lease_del();
void lease_modify();
void lease_menu();
void lease_query();
void lease_save();
void exit8();
/*end of function declaration*/
};//end of class declaration
/*starting of menu function body definetion*/
void lease::lease_menu()
{
market2:
clrscr();
char m3;
screen3();
gotoxy(18,15);
textcolor(CYAN);
cprintf("Lease Division of Marketing Department");
gotoxy(27,17);
cprintf("Lease Division Submenu");
screen1();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Lease Details Entry");//for entry of details
gotoxy(25,24);
cprintf("[2] Lease Details");//for displaying/report
generation
gotoxy(25,27);
cprintf("[3] Lease Deatails Modificatin");//for modify of
details
gotoxy(25,30);
cprintf("[4] Lease details Deletion");//for deletion of
details
gotoxy(25,33);
cprintf("[5] Query For Lease Details");//query for details
gotoxy(25,36);
cprintf("[6] Return To Purchase Division Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
m3=getch();
switch(m3)
{
case '1'://calling of lease_entry function
clrscr();
lease_entry();
rep3:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char m5;
cin>>m5;
switch(m5)
{
case '1'://for more entry
lease_entry();
goto rep3;
case '2':
goto market2;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto rep3;
}
case '2'://calling of lease_details function
clrscr();
lease lo;
lo.lease_details();
fin.clear();
getch();
goto market2;
case'3'://calling of lease_modify function
clrscr();
lease lo1;
lo1.lease_modify();
fin.clear();
getch();
goto market2;
case'4'://calling of lease_del function
clrscr();
lease lo2;
lo2.lease_del();
fin.clear();
getch();
goto market2;
case'5'://calling of lease_query function
clrscr();
lease lo3;
lo3.lease_query();
fin.clear();
getch();
goto market2;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto market2;
}
}//end of function definetion
/*starting of lease_save function definetion*/
void lease::lease_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&lea,sizeof(lea));
gotoxy(23,38);
cout<<"Lease Details Entered.....";
lea.lea_num++;//incrementation of lease number
clear(25,42);
gotoxy(49,38);
}
else
gotoxy(56,42);
return;
}//end of lease_save function body
void lease::exit8()
{
fin.close();
}
/*starting of lease_entry function definition*/
void lease::lease_entry()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(33,10);
cprintf("\nLEASE DETAILS");
screen1();
textcolor(CYAN);
gotoxy(18,21);
cprintf("Enter Lease Number :");
gotoxy(18,23);
cprintf("Enter The Category of Vehicle :");
gotoxy(18,25);
cprintf("Enter The Date :");
gotoxy(18,27);
cprintf("Enter The Name of Owner :");
gotoxy(18,29);
cprintf("Enter The Address :");
gotoxy(18,31);
cprintf("Enter The Payment Mode :");
gotoxy(18,33);
cprintf("Enter The Amount of Payment :");
gotoxy(18,35);
cprintf("Enter The Number :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(52,21);
cout<<lea.lea_num;//showing of lease number through constructor
/*error handling in the case of data entry*/
do
{
valid=1;
gotoxy(52,23);
gets(lea.name);
ch=strlen(lea.name);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,23);
clear(52,23);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,25);
gets(lea.data);
ch=strlen(lea.data);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,25);
clear(52,25);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,27);
gets(lea.n_owner);
ch=strlen(lea.n_owner);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,27);
clear(52,27);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,29);
gets(lea.add);
ch=strlen(lea.add);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,29);
clear(52,29);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,31);
gets(lea.mode);
ch=strlen(lea.mode);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,31);
clear(52,31);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,33);
cin>>lea.pay;
ch1=lea.pay;
if (ch1== 0 )
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(52,33);
clear(52,33);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,35);
gets(lea.num);
ch=strlen(lea.num);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,35);
clear(52,35);
}
}while(!valid);
/*end of error handling*/
lease_save();//calling of lease_save function for user need
fin.clear();
getch();//staying of function
}//end of function body definition
/* starting of lease_details function definition*/
void lease::lease_details()
{
clrscr();
fin.seekg(0,ios::beg);
textcolor(RED);
int m=9;
gotoxy(22,2);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(29,4);
cprintf("Lease Details");
gotoxy(2,6);
textcolor(WHITE);
cout<<"--------------------------------------------------------
-----------------------";
gotoxy(2,7);
textcolor(BLUE);
cprintf("L_no.");
gotoxy(8,7);
cprintf("V_name");
gotoxy(15,7);
cprintf("Number");
gotoxy(26,7);
cprintf("Date");
gotoxy(38,7);
cprintf("N_ofowner");
gotoxy(53,7);
cprintf("Address");
gotoxy(66,7);
cprintf("Mode");
gotoxy(74,7);
cprintf("Amount");
textcolor(WHITE);
gotoxy(2,8);
cout<<"--------------------------------------------------------
-----------------------";
fin.seekg(0,ios::beg);
while(fin.read((char*)&lea,sizeof(lea))!=0)//checking upto end
of file for data display
{
gotoxy(3,m);
cout<<lea.lea_num;
gotoxy(8,m);
cout<<strupr(lea.name);
gotoxy(15,m);
puts(lea.num);
gotoxy(26,m);
cout<<strupr(lea.data);
gotoxy(38,m);
cout<<strupr(lea.n_owner);
gotoxy(53,m);
cout<<strupr(lea.add);
gotoxy(66,m);
cout<<strupr(lea.mode);
gotoxy(75,m);
cout<<lea.pay;
m++;
}
fin.clear();
}//end of function definition
/*starting of lease_modify function definition*/
void lease::lease_modify()
{
clrscr();
int sno;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nLEASE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter The Lease Number To be Modified:");//modify by
lease number
cin>>sno;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&lea,sizeof(lea)))
{
if(lea.lea_num!=sno)
count++;
else
{
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Lease Number :");cout<<lea.lea_num;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,25);
cprintf("Category :");cout<<lea.name;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,27);
cprintf("Date of Lease :");cout<<lea.data;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Name of Owner :");cout<<lea.n_owner;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,31);
cprintf("Owner Address :");cout<<lea.add;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,33);
cprintf("Payment Mode :");cout<<lea.mode;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,35);
cprintf("Amount :");cout<<lea.pay;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,37);
cprintf("Vehicle Number :");cout<<lea.num;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(40,23);
cprintf("Lease Number :");
textcolor(WHITE);
/*checking of duplicate entry*/
do
{
valid=1;
gotoxy(57,23);
cin>>lea.lea_num;
int ck=lea.lea_num;
if(ck!=sno)
{
valid=0;
gotoxy(40,38);
textcolor(CYAN);
cout<<"You Can Not Make Duplicate entry";
textcolor(WHITE);
getch();
clear3(40,38);
gotoxy(57,23);
clear3(57,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Vehicle Category:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,25);
gets(lea.name);
ch=strlen(lea.name);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
textcolor(CYAN);
cout<<"You Can Not Skip(or Make More)Entry";
textcolor(WHITE);
getch();
clear3(40,38);
gotoxy(57,25);
clear3(57,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("The Lease Date :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,27);
gets(lea.data);
ch=strlen(lea.data);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,27);
clear3(57,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Name of Owner :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,29);
gets(lea.n_owner);
ch=strlen(lea.n_owner);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,29);
clear3(57,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("Enter Address :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,31);
gets(lea.add);
ch=strlen(lea.add);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,31);
clear3(57,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("The Payment Mode:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,33);
gets(lea.mode);
ch=strlen(lea.mode);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,33);
clear3(57,33);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("Amount To Pay :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,35);
cin>>lea.pay;
ch1=lea.pay;
if (ch1== 0 )
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(57,35);
clear3(57,35);
}
}while(!valid);
gotoxy(40,37);
textcolor(CYAN);
cprintf("Vehicle Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,37);
gets(lea.num);
ch=strlen(lea.num);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,37);
clear3(57,37);
}
}while(!valid);
/*end of checking*/
pos=count*sizeof(lea);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&lea,sizeof(lea));
gotoxy(45,38);
cout<<"Lease Details modified....";
gotoxy(70,38);
fin.clear();
return;
}
else
return;
}
}
if(pos==0)//if record is not available
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of functio definition
/*starting of lease_del function*/
void lease::lease_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(34,10);
cprintf("\nLEASE DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("temp1.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Lease Number To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&lea,sizeof(lea)))
{
if(lea.lea_num!=code1)
fin1.write((char*)&lea,sizeof(lea));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("lease6.dat");
rename("temp1.dat","lease6.dat");
fin.open("lease6.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);

gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
}//end of function definition
/*starting of lease_query function definition*/
void lease::lease_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nLEASE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Lease No. To Make Query:");//by using lease
number
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&lea,sizeof(lea))!=0)
{
if(lea.lea_num!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nLEASE DETAILS");
textcolor(WHITE);
gotoxy(24,16);
cout<<"Quried Lease Number:"<<vac;
gotoxy(20,22);
textcolor(CYAN);
cprintf("Lease Number :");
gotoxy(20,24);
cprintf("Category of Vehicle :");
gotoxy(20,26);
cprintf("Date :");
gotoxy(20,28);
cprintf("Name of Ownwr :");
gotoxy(20,30);
cprintf("Address of Owner :");
gotoxy(20,32);
cprintf("Payment Mode :");
gotoxy(20,34);
cprintf("Amount of payment :");
gotoxy(20,36);
cprintf("Number of Vehicle :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
/*displaying of particular query*/
gotoxy(45,22);
cout<<lea.lea_num;
gotoxy(45,24);
cout<<strupr(lea.name);
gotoxy(45,26);
cout<<strupr(lea.data);
gotoxy(45,28);
cout<<strupr(lea.n_owner);
gotoxy(45,30);
cout<<strupr(lea.add);
gotoxy(45,32);
cout<<strupr(lea.mode);
gotoxy(45,34);
cout<<lea.pay;
gotoxy(45,36);
cout<<strupr(lea.num);
/*end displaying*/
s++;
if (lea.lea_num==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)//if record is not available
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function definition
/*---------------------End of lease
class------------------------------*/

End of lease class coding.

Starting of expense class coding:


/*------------------------Starting of expense
class------------------------*/
class expense//declaration of expense class
{
protected:
/*stucture declaration of data with their attributes*/
struct expense1
{
int snum;
char date[15];
char matter[20];
float amount;
}ho;//end of declaration
fstream fin,fin1;//decaration of fstream variable
public:
expense()//constructor declaration
{
fin.open("expense7.dat",ios::in|ios::out|ios::binary|
ios::ate);
ho.snum=1;//initialization of serial number
}
~expense()//destructor declaration
{
fin.close();//closing of file
delete ho.date,ho.matter;//deletion of structure data
explicitly
}
/*starting of function declaration*/
void expense_entry();
void expense_details();
void expense_menu();
void expense_query();
void expense_save();
/*end of function declaration*/
};//end of class declaration
/*starting of menu function body*/
void expense::expense_menu()
{
market6:
clrscr();
char muk4;
screen3();
gotoxy(18,15);
textcolor(CYAN);
cprintf("Workshops Division of Marketing Department");
gotoxy(27,17);
cprintf("Expenses Details Submenu");
screen4();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Expenses Entry");//for details entry
gotoxy(25,24);
cprintf("[2] Expenses Details");//for details and report
generation
gotoxy(25,27);
cprintf("[3] Query for Expenses details");//for query
gotoxy(25,30);
cprintf("[4] Return To Workshops Division Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,32);
cprintf("Enter Your Choice:");
textcolor(WHITE);
muk4=getch();
switch(muk4)
{
case '1'://calling of expense_entry function
clrscr();
expense_entry();
rep5:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char muk5;
muk5=getch();
switch(muk5)
{
case '1'://for more entry
expense_entry();
goto rep5;
case '2':
goto market6;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto rep5;
}
case '2'://calling of expense_details function
expense ex;
clrscr();
ex.expense_details();
fin.clear();
getch();
goto market6;
case '3'://calling of expense_query function
expense ex1;
ex1.expense_query();
fin.clear();
getch();
goto market6;
case '4':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto market6;
}
}//end of function body
/*starting of expense_save function body*/
void expense::expense_save()
{
char in;
textcolor(RED+BLINK);
gotoxy(23,32);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&ho,sizeof(ho));
gotoxy(23,32);
cout<<"Expenses Details Entered.....";
ho.snum++;//incrementation of serial number
clear(25,42);
gotoxy(54,32);
}
else
gotoxy(56,42);
return;
}//end of function body
/*starting of expense_enry function*/
void expense::expense_entry()
{
int valid;
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nEXPENSES DETAILS");
screen4();
textcolor(BLUE);
gotoxy(21,21);
cprintf("Serial Number :");
gotoxy(21,24);
cprintf("Enter The Date of Entry :");
gotoxy(21,27);
cprintf("Enter The Matter :");
gotoxy(21,30);
cprintf("Enter The Expenses Amount :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(48,21);
cout<<ho.snum;
do
{
valid=1;
gotoxy(48,24);
gets(ho.date);
char ch=strlen(ho.date);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,24);
clear(48,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(48,27);
gets(ho.matter);
char ch=strlen(ho.matter);
if (ch== 0 || ch>=20)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(48,27);
clear(48,27);
}
}while(!valid);
do
{
valid=1;
gotoxy(48,30);
cin>>ho.amount;
int ch=ho.amount;
if (ch== 0 )
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(48,30);
clear(48,30);
}
}while(!valid);
expense_save();//calling of save function
fin.clear();
getch();
} //end of function body

/*starting of expense_details function body*/


void expense::expense_details()
{
clrscr();
fin.seekg(0,ios::beg);
int m=12;
gotoxy(31,2);
textcolor(RED);
cprintf("THE TRAVEL");
gotoxy(33,4);
cprintf(" AND");
gotoxy(29,6);
cprintf("TRANSPORT AGENCY");
gotoxy(29,8);
cprintf("Expenses Details");
textcolor(WHITE);
gotoxy(9,9);
cout<<"--------------------------------------------------------
------";
gotoxy(11,10);
textcolor(BLUE);
cprintf("S_Number");
gotoxy(21,10);
cprintf("Date_of_Entry");
gotoxy(38,10);
cprintf("Matter");
gotoxy(63,10);
cprintf("Amount");
textcolor(WHITE);
gotoxy(9,11);
cout<<"--------------------------------------------------------
------";
textcolor(WHITE);
int count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&ho,sizeof(ho))!=0)
{
gotoxy(14,m);
cout<<ho.snum;
gotoxy(21,m);
cout<<strupr(ho.date);
gotoxy(38,m);
cout<<strupr(ho.matter);
gotoxy(63,m);
cout<<ho.amount;
m++;
count++;
}
fin.clear();
}//end of function body
/*starting of expense_query function*/
void expense::expense_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(29,10);
cprintf("\nEXPENSES DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Serial Number To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&ho,sizeof(ho))!=0)
{
if(ho.snum!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen4();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(29,10);
cprintf("\nEXPENSES DETAILS");
textcolor(WHITE);
gotoxy(25,16);
cout<<"Quried Expenses serial Number:"<<vac;
gotoxy(20,21);
textcolor(CYAN);
cprintf("Serial Number :");
gotoxy(20,24);
cprintf("Date Of entry :");
gotoxy(20,27);
cprintf("Matter :");
gotoxy(20,30);
cprintf("Expenses Amount :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(44,21);
cout<<ho.snum;
gotoxy(44,24);
cout<<strupr(ho.date);
gotoxy(44,27);
cout<<strupr(ho.matter);
gotoxy(44,30);
cout<<ho.amount;
s++;
if (ho.snum==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function body
/*--------------------------End of Expenses
Class---------------------------*/
End of expenses class coding

 Employee Module Coding:

Starting of employ class coding:

/*-----------------------------Inclution of class for


inheritence----------------------*/
#include"d:\gaurav\tlook.cpp"
/*-----------------------------End of
inclution----------------------------------------*/
/*-----------------------------Stating of employ
class---------------------------------*/
class employ:public employee,salary,tlook//declaration of class
and inheritence of employee,salary and tlook classes
{
public:
void move();//menu making function for Employee module
};//end of class declaration
/*------------------------------starting of move function
definition------------------*/
void employ::move()
{
abc2:
char e;
clrscr();
screen();
gotoxy(28,16);
cout<<"EMPLOYEEE DEPARTMENT MENU";
screen1();
textcolor(5);
gotoxy(24,21);
cprintf(" 1. EMPLOYEE DIVISION");//calling of Employee Division
gotoxy(24,24);
cprintf(" 2. EMPLOYEE SALARY DIVISION");//calling of Salary
Division
gotoxy(24,27);
cprintf(" 3. TIME TABLE DETAILS");//calling of Time-Table
Division for employee department
gotoxy(24,30);
cprintf(" 4. REPORT");//calling of report generation menu
gotoxy(24,33);
cprintf(" 5. HELP");//calling of help generation menu
gotoxy(24,36);
cprintf(" 6. RETURN TO MAIN");//return to main menu
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
gotoxy(43,38);
e=getch();
switch(e)
{
case '1'://calling of employee menu function from employee
class
clrscr();
employee est;
est.employee_menu();
goto abc2;
case '2'://calling of salary menu function from salary
class
clrscr();
salary sook;
sook.salary_menu();
goto abc2;
case '3'://calling of tlook menu function from tlook class
clrscr();
tlook cup;
cup.tlook_menu();
goto abc2;
case '4'://calling for report generation
emplo3:
clrscr();
char took;
screen2();
textcolor(RED);
cprintf("\nREPORT MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(30,10);
cprintf("\nEMPLOYEE DEPARTMENT");
textcolor(WHITE);
screen4();
gotoxy(23,21);
textcolor(11);
cprintf("1.Employee Report");//generation fo employee
report
gotoxy(23,24);
cprintf("2.Salary Report");//calling of salary report
gotoxy(23,27);
cprintf("3.Time_Table Report");//generation of
time_table report
gotoxy(23,30);
cprintf("4.Return To Administrative Menu");
textcolor(WHITE);
textcolor(YELLOW+BLINK);
gotoxy(25,33);
cprintf("Enter Your Choice");
textcolor(WHITE);
took=getch();
switch(took)
{
case '1'://calling of employee details from
employee class
clrscr();
employee ewq;
ewq.employee_details();
getch();
goto emplo3;
case '2'://calling of salary show function from
salary class
clrscr();
salary sak;
sak.salary_show();
getch();
goto emplo3;
case '3'://calling of tlook details function from
tlook class
clrscr();
tlook_details();
getch();
goto emplo3;
case '4':
goto abc2;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto emplo3;
}
case '5'://calling of help generation menu
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(30,10);
cprintf("\nEMPLOYEE DEPARTMENT");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(15,16);
cprintf("IF CHOICE:1# ");
textcolor(GREEN);
gotoxy(21,18);
cprintf("The User can work with the Employee
Divisin.");
gotoxy(16,20);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,21);
textcolor(GREEN);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,22);
cprintf("Details of Employee Details.");
textcolor(RED);
gotoxy(15,24);
cprintf("IF CHOICE:2# ");
textcolor(GREEN);
gotoxy(21,26);
cprintf("The User can Work with the Salary
Divisin.");
gotoxy(16,28);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,29);
textcolor(GREEN);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,30);
cprintf("Details of Salary Details and");
gotoxy(21,31);
cprintf("Expenses Details.");
textcolor(RED);
gotoxy(15,33);
cprintf("IF CHOICE:3# ");
textcolor(GREEN);
gotoxy(21,35);
cprintf("User can Generate Report For all above
choices.");
gotoxy(18,39);
textcolor(5);
cprintf("Press Any Key To Continue........");
textcolor(WHITE);
getch();
goto abc2;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto abc2;
}
}//end of function body
/*--------------------------End of Employ
class-----------------------------*/

End of employ class coding.


Starting of tlook class coding:

/*-------------------------Starting of tlook
class---------------------------*/
class tlook//declaration of class
{
private:
int valid;
char ch;
int ch1;
fstream fin,fin1;//variable declaration of fstream
variable
/*declaration of structure data with their data types*/
struct tlook2
{
int jcode;
char attend[7];
char leave[7];
int day;
int year;
}tom;//end of structure declaration
public:
tlook()//constructor declaration
{
fin.open("tlook.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"unable to open file";
getch();
exit14();
}
}
~tlook()//destructor declaration
{
fin1.close();//closing of file stream
delete tom.attend,tom.leave;//deletion of struct data
explicitly
}
/*starting of function declaration*/
void tlook_entry();
void tlook_details();
void tlook_modify();
void tlook_del();
void tlook_menu();
void tlook_query();
void tlook_save();
void exit14();
/*end of function declaration*/
};//end of class decaration
/*starting of tlook_menu function definition*/
void tlook::tlook_menu()
{
emplo2:
clrscr();
char t;
screen3();
gotoxy(30,15);
textcolor(CYAN);
cprintf("EMPLOYEE DEPARTMENT");
gotoxy(22,17);
cprintf("TIME TABLE DIVISION FOR EMPLOYEE");
textcolor(WHITE);
screen1();
textcolor(GREEN);
gotoxy(23,21);
cprintf("[1] Entry of Time_Table Details");//entry of details
gotoxy(23,24);
cprintf("[2] Time_Table Details");//for details/report
generation
gotoxy(23,27);
cprintf("[3] Modify of Details");//for modifying of details
gotoxy(23,30);
cprintf("[4] Deletion of details");//for deletion of details
gotoxy(23,33);
cprintf("[5] Query for Employee Time-Table");//for query of
details
gotoxy(23,36);
cprintf("[6] Return to Employee Department Menu");
textcolor(YELLOW+BLINK);
gotoxy(32,38);
cprintf("Enter Your choice:");
textcolor(WHITE);
t=getch();
switch(t)
{
case '1'://calling of tlook_entry function
clrscr();
tlook_entry();
ti:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char ti1;
cin>>ti1;
switch(ti1)
{
case '1'://for more entry
tlook_entry();
goto ti;
case '2':
goto emplo2;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto ti;
}
case '2'://calling of tlook_details functon
clrscr();
tlook tu;
tu.tlook_details();
fin.clear();
getch();
goto emplo2;
case'3'://calling of tlook_modify function
clrscr();
tlook tu1;
tu1.tlook_modify();
fin.clear();
getch();
goto emplo2;
case'4'://calling of tlook_del function
clrscr();
tlook tu2;
tu2.tlook_del();
fin.clear();
getch();
goto emplo2;
case'5'://calling of tlook_query function
clrscr();
tlook tu3;
tu3.tlook_query();
fin.clear();
getch();
goto emplo2;
case'6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto emplo2;
}
}//end of menu function definition
/*starting of tlook_save function definition*/
void tlook::tlook_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&tom,sizeof(tom));
gotoxy(23,38);
cout<<"Time-Table Details Entered.....";
clear(25,42);
gotoxy(53,38);
}
else
gotoxy(56,38);
return;
}//end of function definition
void tlook::exit14()//function for error handling
{
fin.close();
}
/*sarting of table_entry function defintion body*/
void tlook::tlook_entry()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(25,10);
cprintf("\nTIME-TABLE DEATILS OF EMPLOYEE");
screen1();
textcolor(CYAN);
gotoxy(21,23);
cprintf("Enter The Job_code of Employee :");
gotoxy(21,26);
cprintf("Enter The Attend Time :");
gotoxy(21,29);
cprintf("Enter The Leave Time :");
gotoxy(21,32);
cprintf("Enter The Working Days :");
gotoxy(21,35);
cprintf("Enter The Working Years :");
textcolor(WHITE);
fin.seekp(0,ios::end);
/*starting of error checking during data entry*/
do
{
valid=1;
gotoxy(53,23);
cin>>tom.jcode;
ch1=tom.jcode;
if (ch1 == 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(53,23);
clear(53,23);
}
}while(!valid);
do
{
valid=1;
gotoxy(53,26);
gets(tom.attend);
ch=strlen(tom.attend);
if (ch== 0 || ch>=7)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(53,26);
clear(53,26);
}
}while(!valid);
do
{
valid=1;
gotoxy(53,29);
gets(tom.leave);
ch=strlen(tom.leave);
if (ch== 0 || ch>=7)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(53,29);
clear(53,29);
}
}while(!valid);
do
{
valid=1;
gotoxy(53,32);
cin>>tom.day;
ch1=tom.day;
if (ch1 == 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(53,32);
clear(53,32);
}
}while(!valid);
do
{
valid=1;
gotoxy(53,35);
cin>>tom.year;
ch1=tom.year;
if (ch1 == 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(53,35);
clear(53,35);
}
}while(!valid);
/*end of error checking*/
tlook_save();//calling of tlook_save function for user need
fin.clear();
getch();
}//end of function defintion
/*starting of tlook_details dfinition*/
void tlook::tlook_details()
{
clrscr();
fin.seekg(0,ios::beg);
int m=12;
gotoxy(31,2);
textcolor(RED);
cprintf("THE TRAVEL");
gotoxy(33,4);
cprintf(" AND");
gotoxy(29,6);
cprintf("TRANSPORT AGENCY");
gotoxy(28,8);
cprintf("Time_Table Details");
textcolor(WHITE);
gotoxy(9,9);
cout<<"--------------------------------------------------------
------";
textcolor(BLUE);
gotoxy(10,10);
cprintf("Emp_jcode");
gotoxy(23,10);
cprintf("Attend_Time");
gotoxy(39,10);
cprintf("Leave_Time");
gotoxy(54,10);
cprintf("W_days");
gotoxy(64,10);
cprintf("W_year");
textcolor(WHITE);
gotoxy(9,11);
cout<<"--------------------------------------------------------
------";
textcolor(WHITE);
fin.seekg(0,ios::beg);
while(fin.read((char*)&tom,sizeof(tom))!=0)
{
gotoxy(12,m);
cout<<tom.jcode;
gotoxy(24,m);
cout<<strupr(tom.attend);
gotoxy(40,m);
cout<<strupr(tom.leave);
gotoxy(57,m);
cout<<tom.day;
gotoxy(66,m);
cout<<tom.year;
m++;
}
fin.clear();
}//end of function definition
/*starting of tlook_modify function definition*/
void tlook::tlook_modify()
{
clrscr();
int so;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(25,10);
cprintf("\nTIME-TABLE DETAILS FOR EMPLOYEE");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter The Job_code To be Modified:");
cin>>so;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&tom,sizeof(tom)))
{
if(tom.jcode!=so)
count++;
else
{
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Job Code :");cout<<tom.jcode;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,26);
cprintf("Attend Time :");cout<<tom.attend;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Leave Time :");cout<<tom.leave;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,32);
cprintf("Working Day :");cout<<tom.day;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,35);
cprintf("Working Year :");cout<<tom.year;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Enter Job_code :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,23);
cin>>tom.jcode;
int ck=tom.jcode;
if(ck!=so)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Make Duplicate entry";
getch();
clear3(40,38);
gotoxy(56,23);
clear3(56,23);
}
}while(!valid);
gotoxy(40,26);
textcolor(CYAN);
cprintf("The Attend Time:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,26);
gets(tom.attend);
ch=strlen(tom.attend);
if (ch== 0 || ch>=7)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,26);
clear3(56,26);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("The Leave Time :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,29);
gets(tom.leave);
ch=strlen(tom.leave);
if (ch== 0 || ch>=7)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,29);
clear3(56,29);
}
}while(!valid);
gotoxy(40,32);
textcolor(CYAN);
cprintf("Working Days :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,32);
cin>>tom.day;
ch1=tom.day;
if (ch1 == 0)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(56,32);
clear3(56,32);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("Working Years :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,35);
cin>>tom.year;
ch1=tom.year;
if (ch1 == 0)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(56,35);
clear3(56,35);
}
}while(!valid);
pos=count*sizeof(tom);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&tom,sizeof(tom));
gotoxy(42,38);
cout<<"Time Details modified....";
fin.clear();
gotoxy(68,38);
return;
}
else
return;
}
}
if(pos==0)//if record is not found
gotoxy(21,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of function definition
/*starting of tlook_del function definition body*/
void tlook::tlook_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");

gotoxy(39,8);
cprintf("\nOF");
gotoxy(25,10);
cprintf("\nTIME-TABLE DETAILS OF EMPLOYEE");
textcolor(WHITE);
screen4();
int code2;
fin1.open("temu.dat",ios::out);
gotoxy(21,24);
cprintf("Enter The Serial Number To be Deleted:");
cin>>code2;
fin.seekg(0,ios::beg);
int found2=0;
while(fin.read((char*)&tom,sizeof(tom)))
{
if(tom.jcode!=code2)
fin1.write((char*)&tom,sizeof(tom));
else
found2=1;
}
if(found2==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found2==1)
{
fin.close();
fin1.close();
remove("tlook.dat");
rename("temu.dat","tlook.dat");
fin.open("tlook.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
fin.clear();
}
}//end of function definition
/*starting of tlook_query function definition*/
void tlook::tlook_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\ntime TABLE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Job code To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&tom,sizeof(tom))!=0)
{
if(tom.jcode!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen4();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\nTIME-TABLE DETAILS");
textcolor(WHITE);
gotoxy(28,16);
cout<<"Quried Job Code:"<<vac;
gotoxy(20,21);
textcolor(CYAN);
cprintf("Job Code :");
gotoxy(20,24);
cprintf("Attend Time :");
gotoxy(20,27);
cprintf("Leave Time :");
gotoxy(20,30);
cprintf("Working Days :");
gotoxy(20,33);
cprintf("Working Years :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(40,21);
cout<<tom.jcode;
gotoxy(40,24);
cout<<strupr(tom.attend);
gotoxy(40,27);
cout<<strupr(tom.leave);
gotoxy(40,30);
cout<<tom.day;
gotoxy(40,33);
cout<<tom.year;
s++;
if (tom.jcode==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)//if record is not found
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of function definition
/*-----------------------End of Tlook
Class-----------------------*/
End of tlook class coding.

 Roadways Module Coding:

Starting of road class coding:

/*-------------------------Inclution of classes for


inheritence-----------------------*/
#include"d:\gaurav\counter.cpp"
#include"d:\gaurav\vehicle.cpp"
#include"d:\gaurav\table.cpp"
#include"d:\gaurav\munsi.cpp"
/*-------------------------End of
Inclution-------------------------------------------*/
/*-----------------Starting of road class for creation of
Roadways Department Menu---------*/
class road:public counter,vehicle,table,munsi//declaration of
class with inhritence of counter,vehicle,munsi and table class
{
public:
void march();//declaration of function for creation of
roadways menu
};
/*------------------------------End of class
declaration-----------------------------------*/
/*-----------------------------Starting of march function
definition-----------------------*/
void road::march()
{
abc3:
char ro;
clrscr();
screen();
gotoxy(30,16);
cout<<"ROADWAYS DEPARTMENT MENU";
screen1();
textcolor(GREEN);
gotoxy(24,20);
cprintf(" 1. VEHICLE DIVISION");//calling of vehicle division
gotoxy(24,23);
cprintf(" 2. TIME-TABLE DIVISION");//calling of time-table
division
gotoxy(24,26);
cprintf(" 3. TRUCK COUNTER DIVISION");//calling of truck
counter division
gotoxy(24,29);
cprintf(" 4. MUNSI CONTROL SECTION");//calling of munsi control
section
gotoxy(24,32);
cprintf(" 5. REPORT");//calling of report generation menu
gotoxy(24,35);
cprintf(" 6. HELP");//calling of help menu
gotoxy(24,38);
cprintf(" 7. RETURN TO MAIN");//return to main menu
textcolor(YELLOW+BLINK);
gotoxy(25,39);
cprintf("Enter Your Choice:");
textcolor(WHITE);
gotoxy(43,39);
ro=getch();
switch(ro)
{
case '1'://calling the vehicle_menu function from vehicle
class
clrscr();
vehicle::vehicle_menu();
goto abc3;
case '2'://calling the table_menu function from table class
clrscr();
table::table_menu();
goto abc3;
case '3'://calling of the counter_menu function from munsi
class
clrscr();
counter::counter_menu();
goto abc3;
case '4'://calling of the munsi_menu function from munsi
and passenger class
clrscr();
munsi::munsi_menu();
goto abc3;
case '5'://calling of report generation menu
repo:
clrscr();
char cool;
screen2();
textcolor(RED);
cprintf("\nREPORT MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(30,10);
cprintf("\nROADWAYS DEPARTMENT");
textcolor(WHITE);
screen1();
gotoxy(23,22);
textcolor(5);
cprintf("1.Vechile Report");
gotoxy(23,25);
cprintf("2.Time-Table Report");
gotoxy(23,28);
cprintf("3.Counter Report");
gotoxy(23,31);
cprintf("4.Passenger Report");
gotoxy(23,34);
cprintf("5.Income Report");
gotoxy(23,37);
cprintf("6.Return To Roadways Department Menu");
textcolor(WHITE);
textcolor(YELLOW+BLINK);
gotoxy(25,39);

cprintf("Enter Your Choice:");


textcolor(WHITE);
cool=getch();
switch(cool)
{
case '1'://calling from vehicle class
clrscr();
vehicle hick;
hick.display();
getch();
goto repo;
case '2'://calling from table class
clrscr();
table::table_display();
getch();
goto repo;
case '3'://calling from counter class
clrscr();
counter com;
com.counter_display();
getch();
goto repo;
case '4'://calling from passenger class
munsi mon;
mon.passenger_display();
getch();
goto repo;
case '5'://calling from munsi class
munsi ipc;
ipc.income_display();
getch();
goto repo;
case '6':
goto abc3;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto repo;
}
case '6'://callling for help generation menu
clrscr();
screen2();
textcolor(RED);
gotoxy(35,6);
cprintf("\nHELP MENU");
gotoxy(39,8);
cprintf("\nFOR");
gotoxy(30,10);
cprintf("\nROADWAYS DEPARTMENT");
textcolor(WHITE);
help();
textcolor(RED);
gotoxy(15,15);
cprintf("IF CHOICE:1# ");
textcolor(11);
gotoxy(21,16);
cprintf("The User can work with the Bus&Truck
Divisin.");
gotoxy(16,17);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,18);
textcolor(11);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,19);
cprintf("Details of Vechicles Details.");
textcolor(RED);
gotoxy(15,21);
cprintf("IF CHOICE:2# ");
textcolor(11);
gotoxy(21,22);
cprintf("The User can Work with the Time-Table
Divisin.");
gotoxy(16,23);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,24);
textcolor(11);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,25);
cprintf("Details of Time-Table Details for
Roadways.");
gotoxy(15,27);
textcolor(RED);
cprintf("IF CHOICE:3# ");
gotoxy(21,28);
textcolor(11);
cprintf("The User can Work with The Counter
Division.");
gotoxy(16,29);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,30);
textcolor(11);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,31);
cprintf("Details of Details for Truck Counter.");
gotoxy(15,33);
textcolor(RED);
cprintf("IF CHOICE:4# ");
gotoxy(21,34);
textcolor(11);
cprintf("The User can Work with The Munsi Control
Section.");
gotoxy(16,35);
textcolor(5);
cprintf("IF SUB CHOICE:#");
gotoxy(21,36);
textcolor(11);
cprintf("The User can make Entry,Modify,Delete and
take");
gotoxy(21,37);
cprintf("Details of Passenger & Time-Table.");
gotoxy(15,39);
textcolor(RED);
cprintf("IF CHOICE:5# ");
gotoxy(21,40);
textcolor(11);
cprintf("User can Generate Report For all above
choices.");
gotoxy(18,41);
textcolor(5);
cprintf("Press Any Key To Continue........");
textcolor(WHITE);
getch();
goto abc3;
case '7':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto abc3;
}
}
/*------------------End of road class
definition-----------------------*/
End of road class definition.

Starting of counter class coding:

/*-------------------Starting of counter
class----------------------*/
class counter//class declaration
{
protected:
/*declaration of variable for error checking*/
char ch;
int valid;
int ch1;
/*end of variable declaration*/
/*definition of structure for data*/
struct counter1
{
int snum;
char number[12];
char source[17];
char desti[17];
char date[15];
float amount;
int jcode;
}hero;//structure variable with end of dclaration
fstream fin,fin1;//declaration of fstream variable
public:
//vehicle vol;
counter()//constructor declaration
{
fin.open("counter.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit9();
}
hero.snum=1;//assinment of serial number
}
~counter()//declaration of destructor
{
delete
hero.number,hero.source,hero.desti,hero.date;//deletion of
structure data explicitly
fin.close();//closing of file
}

/*starting of function declaration*/


void counter_entry();
void counter_display();
void counter_modify();
void counter_del();
void counter_menu();
void counter_query();
void counter_save();
void exit9();
/*end of function declartion*/
};
/*starting of menu function*/
void counter::counter_menu()
{
coun:
clrscr();
char co;
screen3();
gotoxy(29,15);
textcolor(CYAN);
cprintf("ROADWAYS DEPARTMENT");
gotoxy(31,17);
cprintf("Counter Division");
textcolor(WHITE);
screen1();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Truck Counter Details Entry");//for entry of
details
gotoxy(25,24);
cprintf("[2] Counter Details");//for details and report
generation
gotoxy(25,27);
cprintf("[3] Truck Details Modification");//for details
modiication
gotoxy(25,30);
cprintf("[4] Truck Details Deletion");//for deletion of details
gotoxy(25,33);
cprintf("[5] Query for Truck Counter");//query for details
gotoxy(25,36);
cprintf("[6] Return To RoadWays Department Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
co=getch();
switch(co)
{
case '1'://callingf of counter_entry function
clrscr();
counter_entry();
co:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char co1;
cin>>co1;
switch(co1)
{
case '1'://for more entry
counter_entry();
flush(fin);
goto co;
case '2':
goto coun;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto co;
}
case '2'://calling of counter_display function
counter com;
com.counter_display();
fin.clear();
getch();
goto coun;
case '3'://calling of counter_modify function
counter com1;
com1.counter_modify();
fin.clear();
getch();
goto coun;
case '4'://calling of counter_del funtion
counter com2;
com2.counter_del();
fin.clear();
getch();
goto coun;
case '5'://calling of counter_query function
counter com3;
com3.counter_query();
fin.clear();
getch();
goto coun;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto coun;
}
}//end of menu function
/*starting of counter_save function defination*/
void counter::counter_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&hero,sizeof(hero));
gotoxy(23,37);
cprintf("Counter Details Entered.....");
hero.snum++;//encrementation of serial number
clear(25,42);
gotoxy(52,37);
}
else
gotoxy(56,42);
return;
}//end of counter_save function
void counter::exit9()//function for error handling
{
fin.close();
fin.clear();
}
/*starting of counter_entry function defination*/
void counter::counter_entry()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(33,10);
cprintf("\nCOUNTER DETAILS");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,22);
cprintf("Serial Number :");
gotoxy(18,24);
cprintf("Enter The Truck Number :");
gotoxy(18,26);
cprintf("Enter The Source From Go :");
gotoxy(18,28);
cprintf("Enter The Date To Go :");
gotoxy(18,30);
cprintf("Enter The Destination :");
gotoxy(18,32);
cprintf("Enter The Charge :");
gotoxy(18,34);
cprintf("Enter The Head_Jcode :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(49,22);
cout<<hero.snum;
do
{
valid=1;
gotoxy(49,24);
gets(hero.number);
ch=strlen(hero.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cprintf("You Can Not Skip(or Make More) This Entry");
getch();
clear(18,38);
gotoxy(49,24);
clear(49,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,26);
gets(hero.source);
ch=strlen(hero.source);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(18,38);
cprintf("You Can Not Skip(or Make More) This Entry");
getch();
clear(18,38);
gotoxy(49,26);
clear(49,26);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,28);
gets(hero.date);
ch=strlen(hero.date);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cprintf("You Can Not Skip(or Make More) This Entry");
getch();
clear(18,38);
gotoxy(49,28);
clear(48,28);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,30);
gets(hero.desti);
ch=strlen(hero.desti);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(18,38);
cprintf("You Can Not Skip(or Make More) This Entry");
getch();
clear(18,38);
gotoxy(49,30);
clear(49,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,32);
cin>>hero.amount;
float ch=hero.amount;
if (ch== 0 )
{
valid=0;
gotoxy(18,38);
cprintf("You Can Not Skip This Entry");
getch();
clear(18,38);
gotoxy(49,32);
clear(49,32);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,34);
cin>>hero.jcode;
ch1= hero.jcode;
if (ch1== 0)
{
valid=0;
gotoxy(18,38);
cprintf("You Can Not Skip This Entry");
getch();
clear(18,38);
gotoxy(49,34);
clear(49,34);
}
}while(!valid);
counter_save();
fin.clear();
getch();
}//end of function defination
/*starting of counter_display function*/
void counter::counter_display()
{
clrscr();
textcolor(RED);
int m=9;
gotoxy(22,2);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
cout<<endl;
gotoxy(29,4);
cprintf("Counter Details");
textcolor(WHITE);
gotoxy(2,6);
cprintf("------------------------------------------------------
-------------------------\n\n");
gotoxy(2,7);
textcolor(BLUE);
cprintf("Sno");
gotoxy(7,7);
cprintf("Truck_No.");
gotoxy(20,7);
cprintf("Source");
gotoxy(35,7);
cprintf("Desination");
gotoxy(50,7);
cprintf("Date");
gotoxy(63,7);
cprintf("Charge");
gotoxy(73,7);
cprintf("H_Jcode");
textcolor(WHITE);
gotoxy(2,8);
cprintf("------------------------------------------------------
-------------------------\n\n");
textcolor(WHITE);
fin.seekg(0,ios::beg);
while(fin.read((char*)&hero,sizeof(hero))!=0)
{
gotoxy(2,m);
cout<<hero.snum;
gotoxy(7,m);
cout<<strupr(hero.number);
gotoxy(20,m);
cout<<(strupr(hero.source));
gotoxy(35,m);
cprintf(strupr(hero.desti));
gotoxy(50,m);
cprintf(strupr(hero.date));
gotoxy(63,m);
cout<<hero.amount;
gotoxy(73,m);
cout<<hero.jcode;
m++;
}
fin.clear();
}//end of function defination
/* starting of counter_modify function*/
void counter::counter_modify()
{
clrscr();
int number1;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nCOUNTER DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
textcolor(CYAN);
cprintf("Enter Serial No. of Details To be
Modified:");//modifying through serial number
textcolor(WHITE);
cin>>number1;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&hero,sizeof(hero)))
{
if(hero.snum!=number1)
count++;
else
{
int ck;
/*displaying of old value for reference*/
scoot();
textcolor(GREEN);
gotoxy(12,21);
cprintf("Old Value");
gotoxy(12,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Serial Number:");cout<<hero.snum;
textcolor(WHITE);
gotoxy(5,25);
textcolor(CYAN);
cprintf("Truck Number :");cout<<hero.number;
textcolor(WHITE);
gotoxy(5,27);
textcolor(CYAN);
cprintf("Source :");cout<<hero.source;
textcolor(WHITE);
gotoxy(5,29);
textcolor(CYAN);
cprintf("Destination :");cout<<hero.desti;
textcolor(WHITE);
gotoxy(5,31);
textcolor(CYAN);
cprintf("Date :");cout<<hero.date;

textcolor(WHITE);
gotoxy(5,33);
textcolor(CYAN);
cprintf("Charge :");cout<<hero.amount;
textcolor(WHITE);
gotoxy(5,35);
textcolor(CYAN);
cprintf("Head Job Code:");cout<<hero.jcode;
textcolor(WHITE);
/*entering of new value*/
scoot1();
textcolor(GREEN);
gotoxy(47,21);
cprintf("Enter New Value");
gotoxy(47,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Serial Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,23);
cin>>hero.snum;
ck=hero.snum;
if(ck!=number1)
{
valid=0;
gotoxy(40,38);
cprintf("Not Make Duplicate entry");
getch();
clear3(40,38);
gotoxy(56,23);
clear3(56,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Truck Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,25);
gets(hero.number);
ch=strlen(hero.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cprintf("Not Skip(or Make More)Entry");
getch();
clear3(40,38);
gotoxy(56,25);
clear3(56,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("Source To Go :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,27);
gets(hero.source);
ch=strlen(hero.source);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(40,38);
cprintf("Not Skip(or Make More)Entry");
getch();
clear3(40,38);
gotoxy(56,27);
clear3(56,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("The Destination:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,29);
gets(hero.desti);
ch=strlen(hero.desti);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(40,38);
cprintf("Not Skip(or Make More)Entry");
getch();
clear3(40,38);
gotoxy(56,29);
clear3(56,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("The Date To Go :");
textcolor(WHITE);

do
{
valid=1;
gotoxy(56,31);
gets(hero.date);
ch=strlen(hero.date);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cprintf("Not Skip(or Make More)Entry");
getch();
clear3(40,38);
gotoxy(56,31);
clear3(56,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("Enter Charge :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,33);
cin>>hero.amount;
float ch=hero.amount;
if (ch== 0 )
{
valid=0;
gotoxy(40,38);
cprintf("Not Skip This Entry");
getch();
clear3(56,38);
gotoxy(56,33);
clear3(56,33);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("The Head Jcode :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,35);
cin>>hero.jcode;
ch1= hero.jcode;
if (ch1== 0)
{
valid=0;
gotoxy(40,38);
cprintf("Not Skip This Entry");
getch();
clear3(40,38);
gotoxy(56,35);
clear3(56,35);
}
}while(!valid);
pos=count*sizeof(hero);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&hero,sizeof(hero));
gotoxy(45,38);
cout<<"Counter Details modified....";
gotoxy(72,38);
return;
}
else
return;
}
}
if(pos==0)
gotoxy(20,42);
cprintf("Record Not Found ! Try Again..... ");
fin.clear();
textcolor(WHITE);
fin.clear();
}//end of function defination
/*starting of counter_del function deination*/
void counter::counter_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(34,10);
cprintf("\nCOUNTER DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("coo.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Serial No.To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&hero,sizeof(hero)))
{
if(hero.snum!=code1)
fin1.write((char*)&hero,sizeof(hero));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cprintf("Record is Not Found! Try Again...");
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("counter4.dat");
rename("coo.dat","counter4.dat");
fin.open("counter4.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cprintf("Record Has been Successfully Deleted...");
textcolor(RED+BLINK);
gotoxy(32,38);
cprintf("Press Any To Exit:");
textcolor(WHITE);
}
fin.clear();
fin1.clear();
}//end of functio defination
/*starting of counter_query function defination*/
void counter::counter_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(27,10);
cprintf("\nTRUCK COUNTER DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);

cprintf("Enter Serial Number To Make Query:");


cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&hero,sizeof(hero))!=0)
{
if(hero.snum!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\nTRUCK COUNTER DETAILS");
textcolor(WHITE);
gotoxy(27,16);
textcolor(CYAN);
cout<<"Quried serial Number:"<<vac;
gotoxy(20,22);
cprintf("Serial Number :");
gotoxy(20,24);
cprintf("Truck Number :");
gotoxy(20,26);
cprintf("Source From Go :");
gotoxy(20,28);
cprintf("Date To Go :");
gotoxy(20,30);
cprintf("Destination :");
gotoxy(20,32);
cprintf("Charge :");
gotoxy(20,34);
cprintf("Head Jcode :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(42,22);
cout<<hero.snum;
gotoxy(42,24);
cprintf(strupr(hero.number));
gotoxy(42,26);
cprintf(strupr(hero.source));
gotoxy(42,28);
cprintf(strupr(hero.date));
gotoxy(42,30);
cprintf(strupr(hero.desti));
gotoxy(42,32);
cout<<hero.amount;
gotoxy(42,34);
cout<<hero.jcode;
s++;
if (hero.snum==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cprintf("Record Not Found! Try Again..... ");
fin.clear();
return;
}//end of function defination
/*----------------------End of Counter
Class-------------------------*/
End of counter class coding.

Starting of vehicle class coding:

/*-------------------Starting of vehicle class-------------------


*/
class vehicle//class declaration
{
protected:
/*structure declaration for data with their data types*/
struct vehicle1
{
char number[12];
int sn;
char status[10];
char pdate[15];
char wstatus[5];
char category[7];
}vol;//end of structure declaration with structue
variable
fstream fin,fin1;//fstream variable
public:
vehicle()//constructor declaration
{
fin.open("vehicle.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable to Open File";
getch();
exit15();
}
vol.sn=1;//initialization of serial number
}
~vehicle()//destructor declaration
{
fin.close();
delete
vol.number,vol.status,vol.pdate,vol.wstatus,vol.category;//deleti
on of structor declaration explicitly
}
/*starting of function declaration*/
void entry();
void display();
void modify();
void del();
void vehicle_menu();
void query();
void save();
void exit15();
/*end of function declaration*/
};//end of class declaration
/*starting of menu function defination*/
void vehicle::vehicle_menu()
{
vecho:
clrscr();
char ve;
screen3();
gotoxy(30,15);
textcolor(CYAN);
cprintf("ROADWAYS DEPARTMENT");
gotoxy(31,17);
cprintf("Vehicle Division");
screen1();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Vehicle Entry");//for vehicle details entry
gotoxy(25,24);
cprintf("[2] Vehicle Details");//for details
gotoxy(25,27);
cprintf("[3] Vehicle Modifiction");//for modification of
details
gotoxy(25,30);
cprintf("[4] Vehicle Deletion");//for deletion of records
gotoxy(25,33);
cprintf("[5] Query for Vehicle details");//for query
gotoxy(25,36);
cprintf("[6] Return To RoadWays Department Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
ve=getch();
switch(ve)
{
case '1'://calling of entry function
clrscr();
entry();
vcl:

gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char ve1;
cin>>ve1;
switch(ve1)
{
case '1'://for more entry
entry();
goto vcl;
case '2':
goto vecho;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto vcl;
}
case '2'://calling of display function
vehicle vim;
vim.display();
getch();
goto vecho;
case '3'://calling of modify function
vehicle vim1;
vim1.modify();
getch();
goto vecho;
case '4'://calling of del function
vehicle vim2;
vim2.del();
getch();
goto vecho;
case '5'://calling of query function
vehicle vim3;
vim3.query();
getch();
goto vecho;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto vecho;
}
}//end of menu function
/*starting of save function declaration*/
void vehicle::save()
{
char in;
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
in=getche();
textcolor(WHITE);
if (in == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&vol,sizeof(vol));
gotoxy(23,38);
cout<<"vehicle Details Entered.....";
vol.sn++;//incrementation of serial number
clear(25,42);
gotoxy(37,65);
}
else
gotoxy(56,42);
return;
}//end of save function defination
void vehicle::exit15()//function for error handling
{
fin.close();
}
/*starting of entry function declaration*/
void vehicle::entry()
{
int valid;
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(33,10);
cprintf("\nVEHICLE DETAILS");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,21);
cprintf("Enter The serial Number :");
gotoxy(18,24);
cprintf("Enter The Vechile's Number :");
gotoxy(18,27);
cprintf("Enter The Category :");
gotoxy(18,30);
cprintf("Enter The Status :");
gotoxy(18,33);
cprintf("Enter The Purchasing date :");
gotoxy(18,36);
cprintf("Enter The Working Status :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(55,21);
cout<<vol.sn;
do
{
valid=1;
gotoxy(55,24);
gets(vol.number);
char ch=strlen(vol.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(55,24);
clear(55,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(55,27);
gets(vol.category);
char ch=strlen(vol.category);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(55,27);
clear(55,27);
}
}while(!valid);
do
{
valid=1;
gotoxy(55,30);
gets(vol.status);
char ch=strlen(vol.status);
if (ch== 0 || ch>=10)

{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(55,30);
clear(55,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(55,33);
gets(vol.pdate);
char ch=strlen(vol.pdate);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(55,33);
clear(55,33);
}
}while(!valid);
do
{
valid=1;
gotoxy(55,36);
gets(vol.wstatus);
char ch=strlen(vol.wstatus);
if (ch== 0 || ch>=5)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(55,36);
clear(55,36);
}
}while(!valid);
save();
fin.clear();
getch();
}//end of function defination
/*tarting of display function body*/
void vehicle::display()

{
clrscr();
textcolor(RED);
int m=9;
gotoxy(22,2);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(29,4);
cprintf("Vehicle Details");
textcolor(WHITE);
gotoxy(2,6);
cout<<"--------------------------------------------------------
--------------------";
gotoxy(3,7);
textcolor(BLUE);
cprintf("Sno");
gotoxy(14,7);
cprintf("Vehicle_No.");
gotoxy(32,7);
cprintf("Category");
gotoxy(45,7);
cprintf("Status");
gotoxy(54,7);
cprintf("P_Date");
gotoxy(69,7);
cprintf("W_status");
textcolor(WHITE);
gotoxy(2,8);
cout<<"--------------------------------------------------------
--------------------";
fin.seekg(0,ios::beg);
while(fin.read((char*)&vol,sizeof(vol))!=0)
{
gotoxy(3,m);
cout<<vol.sn;
gotoxy(14,m);
cout<<strupr(vol.number);
gotoxy(32,m);
cout<<strupr(vol.category);
gotoxy(45,m);
cout<<strupr(vol.status);
gotoxy(54,m);
cout<<strupr(vol.pdate);
gotoxy(71,m);
cout<<strupr(vol.wstatus);
m++;
}
fin.clear();
}//end of function body
/*starting of modify function body*/
void vehicle::modify()
{
int valid;
clrscr();
int number1;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nVEHICLE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter Serial No. of Vehicle To be Modified:");
cin>>number1;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&vol,sizeof(vol)))
{
if(vol.sn!=number1)
count++;
else
{
int ck;
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Serial Number :");cout<<vol.sn;
textcolor(WHITE);
textcolor(CYAN);

gotoxy(5,25);
cprintf("Vehicle Number :");cout<<vol.number;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,27);
cprintf("Category :");cout<<vol.category;
textcolor(WHITE);
textcolor(CYAN);

gotoxy(5,29);
cprintf("Status :");cout<<vol.status;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,31);
cprintf("Purchase Date :");cout<<vol.pdate;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,33);
cprintf("Working Status :");cout<<vol.wstatus;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(40,23);
cprintf("Serial Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,23);
cin>>vol.sn;
int ck=vol.sn;
if(ck!=number1)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Make Duplicate entry";
getch();
clear3(40,38);
gotoxy(57,23);
clear3(57,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Vehicle's Number:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,25);
gets(vol.number);
char ch=strlen(vol.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,25);
clear3(57,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("Enter Category :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,27);
gets(vol.category);
char ch=strlen(vol.category);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,27);
clear3(57,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Enter The Status:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,29);
gets(vol.status);
char ch=strlen(vol.status);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,29);
clear3(57,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("Purchasing Date :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,31);
gets(vol.pdate);
char ch=strlen(vol.pdate);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,31);
clear3(57,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("Working Status :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,33);
gets(vol.wstatus);
char ch=strlen(vol.wstatus);
if (ch== 0 || ch>=5)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear(40,38);
gotoxy(57,33);
clear(57,33);
}
}while(!valid);
pos=count*sizeof(vol);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
char ch;
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&vol,sizeof(vol));
gotoxy(42,38);
cout<<"Vehicle Details modified....";
gotoxy(70,38);
return;
}
else
return;
}
}
if(pos==0)
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of function body
/*starting of del function body*/
void vehicle::del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(34,10);
cprintf("\nVEHICLE DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("toop.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Serial No.To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&vol,sizeof(vol)))
{
if(vol.sn!=code1)
fin1.write((char*)&vol,sizeof(vol));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("vehicle.dat");
rename("toop.dat","vehicle.dat");
fin.open("vehicle.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
fin.clear();
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
}//end of function body
/*starting of query function body*/
void vehicle:: query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(27,10);
cprintf("\nVEHICLES DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter Serial Number To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&vol,sizeof(vol))!=0)
{
if(vol.sn!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen4();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\nVEHICLE DETAILS");
textcolor(WHITE);
gotoxy(24,16);
cout<<"Quried Serial Number:"<<vac;
gotoxy(20,22);
cout<<"Serial Number :";
gotoxy(20,24);
cout<<"Vehicle Number :";
gotoxy(20,26);
cout<<"category :";
gotoxy(20,28);
cout<<"Status :";
gotoxy(20,30);
cout<<"Purchasing Date :";
gotoxy(20,32);
cout<<"Working status :";
fin.seekg(0,ios::beg);
gotoxy(45,22);
cout<<vol.sn;
gotoxy(45,24);
cout<<strupr(vol.number);
gotoxy(45,26);

cout<<strupr(vol.category);
gotoxy(45,28);
cout<<strupr(vol.status);
gotoxy(45,30);
cout<<strupr(vol.pdate);
gotoxy(45,32);
cout<<strupr(vol.wstatus);
s++;
if (vol.sn==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//nd of function body
/*--------------------------End of Vehicle
Class-------------------------*/
End of vehicle class coding.

Starting of munsi class coding:

/*----------------------------------Starting of munsi
class---------------------*/
class munsi:public passenger//declaration of munsi class also
inherit the passenfer class
{
protected:
int valid;
char ch;
int ch1;
fstream fin2,fin3;//declaration of file stream variable
/*starting of struct declaration*/
struct munsi2
{
int sno;
char idate[15];
char vnumber[12];
char category[8];
float income;
}muns;//end of struct declaration
public:
munsi()//declaration of contructor
{
fin2.open("munsi.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin2)//error/exception handling
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit11();
}
muns.sno=1;//intialization of serial number
}
~munsi()//definition of destructor
{
fin2.close();//closing of stream declaration
delete muns.idate,muns.vnumber,muns.category;//deletion
of struct variable explicitly
}
/*starting of function declaration*/
void income_entry();
void income_display();
void munsi_menu();
void income_save();
void exit11();
/*end of function declaration*/
};//end of class declaration
/*starting of munsi_menu function definition*/
void munsi::munsi_menu()
{
munpo:
clrscr();
char son;
screen3();
gotoxy(29,15);
textcolor(CYAN);
cprintf("ROADWAYS DEPARTMENT");
gotoxy(28,17);
cprintf("Munsi Control Section");
screen4();
textcolor(GREEN);
gotoxy(25,22);
cprintf("[1] Passenger Details Section ");//calling of
passenger section
gotoxy(25,25);
cprintf("[2] Income Section For Munsi");//calling of munsi
income section
gotoxy(25,28);
cprintf("[3] Return To Roadways Department Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,31);
cprintf("Enter Your Choice:");
textcolor(WHITE);
son=getch();
switch(son)
{
case '1'://calling of passenger fuction
munpo1:
clrscr();
char mo;
screen3();
gotoxy(29,15);
textcolor(CYAN);
cprintf("ROADWAYS DEPARTMENT");
gotoxy(30,17);
cprintf("Passenger Section");
screen1();
textcolor(GREEN);
gotoxy(23,21);
cprintf("[1] Entry of Passenger Details");//entry of
passenger details
gotoxy(23,24);
cprintf("[2] Passenger Details");//for details/report
generation
gotoxy(23,27);
cprintf("[3] Modification Of Passenger Details");//for
modification of details
gotoxy(23,30);
cprintf("[4] Deletion Of Details");//for deltion of
details
gotoxy(23,33);
cprintf("[5] Query for Passenger details");//for query
of details
gotoxy(23,36);
cprintf("[6] Return To Munsi Control Section");
textcolor(YELLOW+BLINK);
gotoxy(32,38);
cprintf("Enter Your choice:");
textcolor(WHITE);
mo=getch();
switch(mo)
{
case'1'://calling of passenger_entry function
clrscr();
passenger_entry();
pass:
gotoxy(21,42);

textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS
KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char co1;
cin>>co1;
switch(co1)
{
case '1'://for more entry
passenger_entry();
goto pass;
case '2':
goto munpo1;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please
retry!!");
textcolor(WHITE);
getch();
goto pass;
}
case '2'://calling of passenger_display function
passenger pa;
pa.passenger_display();
getch();
clrscr();
goto munpo1;
case '3'://calling of passneger_modify function
passenger pa1;
pa1.passenger_modify();
getch();
goto munpo1;
case '4'://calling of passenger_del function
passenger pa2;
pa2.passenger_del();
getch();
goto munpo1;
case '5'://calling of passenger_query function
passenger pa3;
pa3.passenger_query();
getch();
goto munpo1;
case '6':
goto munpo;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto munpo1;
}
case '2'://calling of income function
munpon:
clrscr();
char moo;
screen3();
gotoxy(29,15);
textcolor(CYAN);
cprintf("ROADWAYS DEPARTMENT");
gotoxy(28,17);
cprintf("Income Section For Munsi");
screen4();
textcolor(GREEN);
gotoxy(23,22);
cprintf("[1] Entry of Income Details");//for munsi
income entry
gotoxy(23,25);
cprintf("[2] Income Details");//for dispalying of
details
gotoxy(23,28);
cprintf("[3] Return To Munsi Control Section");
textcolor(YELLOW+BLINK);
gotoxy(32,31);
cprintf("Enter Your choice:");
textcolor(WHITE);

moo=getch();
switch(moo)
{
case'1'://calling of income_entry function
clrscr();
income_entry();
pok:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS
KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char po;
cin>>po;
switch(po)
{
case '1'://for more entry
income_entry();
goto pok;
case '2':
goto munpon;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please
retry!!");
textcolor(WHITE);
getch();
goto pok;
}
case '2'://calling of income_display function
munsi ip;
ip.income_display();
getch();
goto munpon;
case '3':
goto munpo;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto munpon;
}
case '3':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto munpo;
}
}//end of menu function definition
/*starting of income_save function definition*/
void munsi::income_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin2.seekp(0,ios::end);
fin2.write((char*)&muns,sizeof(muns));
gotoxy(23,31);
cout<<"Income Details Entered.....";
muns.sno++;//incrementation of serial number
clear(25,42);
gotoxy(49,31);
}
else
gotoxy(56,42);
return;
}//end of save function definition
void munsi::exit11()//function for error handling
{
fin2.close();
}
/*starting of income_entry function definition*/
void munsi::income_entry()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(33,10);
cprintf("\nINCOME DETAILS");
textcolor(WHITE);
screen4();
textcolor(CYAN);
gotoxy(20,21);
cprintf("Serial Number :");
gotoxy(20,23);
cprintf("Enter The Vehicle Number :");
gotoxy(20,25);
cprintf("Enter The Date :");
gotoxy(20,27);
cprintf("Enter The Category :");
gotoxy(20,29);
cprintf("Enter The Total Income :");
textcolor(WHITE);
fin2.seekp(0,ios::end);
gotoxy(50,21);
cout<<muns.sno;//displaying of serial number byconstructor
do
{
valid=1;
gotoxy(50,23);
gets(muns.vnumber);
ch=strlen(muns.vnumber);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(50,23);
clear(50,23);
}
}while(!valid);
do
{
valid=1;
gotoxy(50,25);
gets(muns.idate);
ch=strlen(muns.idate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(50,25);
clear(50,25);
}
}while(!valid);
do
{
valid=1;
gotoxy(50,27);
gets(muns.category);
ch=strlen(muns.category);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(50,27);
clear(50,27);
}
}while(!valid);
do
{
valid=1;
gotoxy(50,29);
cin>>muns.income;
ch1=muns.income;
if (ch1== 0)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(50,29);
clear(50,29);
}
}while(!valid);
income_save();//calling of income_save function for user need
getch();
}//end of income_entry function
/*starting of income_display function definition*/
void munsi::income_display()
{
clrscr();
int m=9;
gotoxy(22,2);
textcolor(RED);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(25,4);
cprintf("Munsi Income Details");
textcolor(WHITE);
gotoxy(3,6);
cout<<"--------------------------------------------------------
----------------------";
gotoxy(4,7);

textcolor(BLUE);
cprintf("Sno");
gotoxy(10,7);
cprintf("V_Number");
gotoxy(32,7);
cprintf("Date");
gotoxy(53,7);
cprintf("Category");
gotoxy(70,7);
cprintf("Tot_Income");
textcolor(WHITE);
gotoxy(3,8);
cout<<"--------------------------------------------------------
----------------------";
textcolor(WHITE);
fin2.seekg(0,ios::beg);
while(fin2.read((char*)&muns,sizeof(muns))!=0)
{
gotoxy(5,m);
cout<<muns.sno;
gotoxy(10,m);
cout<<strupr(muns.vnumber);
gotoxy(32,m);
cout<<strupr(muns.idate);
gotoxy(53,m);
cout<<strupr(muns.category);
gotoxy(70,m);
cout<<muns.income;
m++;
}
}//end of function definition
/*--------------------------End of Munsi
Class-------------------------*/
End of munsi class coding.

Starting of passenger class coding:

/*------------------------------Starting of passenger
class---------------*/
class passenger//class declaration
{
private:
int valid;
char ch;
int ch1;
fstream fin,fin1;//fstream variable
/*structre declaration for data with their data types*/
struct munsi1
{
int snum;
char pdate[15];
char number[12];
char name[15];
char padd[15];
char desti[17];
char source[17];
}mun;//end of structure declaration
public:
passenger()//constructor declaration
{
fin.open("passenger.dat",ios::in|ios::out|ios::binary|
ios::ate);
if (!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit12();
}
mun.snum=1;//intialization of serial number
}
~passenger()//destructor declaration
{
fin.close();//closing of file stream
delete
mun.pdate,mun.number,mun.name,mun.padd,mun.desti,mun.source;//del
etion of structure data explicitly
}
/*starting of function declaration*/
void passenger_entry();
void passenger_display();
void passenger_modify();
void passenger_del();
void passenger_query();
void passenger_save();
void exit12();
/*end of function declararation*/
};//end of class declaration
/*starting of passenger_save function definition*/
void passenger::passenger_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&mun,sizeof(mun));
gotoxy(23,38);
cout<<"Passenger Details Entered.....";
mun.snum++;//incrementation of serial number
clear(25,42);
gotoxy(51,38);
}
else
gotoxy(56,42);
return;
}//end of passenger_save function definition
void passenger::exit12()//function for error handling
{
fin.close();
}
/*starting of passenger_entry function body*/
void passenger::passenger_entry()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nPASSENGER DETAILS");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,22);
cprintf("Serial Number :");
gotoxy(18,24);
cprintf("Enter The Date of Travelling :");
gotoxy(18,26);
cprintf("Enter The Bus Number :");
gotoxy(18,28);
cprintf("Enter The name of Passenger :");
gotoxy(18,30);
cprintf("Enter The Adderess :");
gotoxy(18,32);
cprintf("Enter The Source :");
gotoxy(18,34);
cprintf("Enter The Destination :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(49,22);
cout<<mun.snum;//displying of serila number through constructor
/*-------------Error handling in the data entry----------------
*/
do
{
valid=1;
gotoxy(49,24);
gets(mun.pdate);
ch=strlen(mun.pdate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(49,24);
clear(49,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,26);
gets(mun.number);
ch=strlen(mun.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(49,26);
clear(49,26);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,28);
gets(mun.name);
ch=strlen(mun.name);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(49,28);
clear(49,28);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,30);
gets(mun.padd);
ch=strlen(mun.padd);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(49,30);
clear(49,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(49,32);
gets(mun.source);
ch=strlen(mun.source);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(49,32);
clear(49,32);
}
}while(!valid);
do
{

valid=1;
gotoxy(49,34);
gets(mun.desti);
ch=strlen(mun.desti);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(49,34);
clear(49,34);
}
}while(!valid);
/*-------------End of Error handling---------------*/
passenger_save();//calling of passenger_save function for user
need
fin.clear();

getch();
}//end of pasenger_entry function
/*starting of passenger_display function definition*/
void passenger::passenger_display()
{
clrscr();
textcolor(RED);
int m=9;
gotoxy(22,2);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(28,4);
cprintf("Passengr Details");
textcolor(WHITE);
gotoxy(1,6);
cout<<"--------------------------------------------------------
------------------------";
gotoxy(1,7);
textcolor(BLUE);
cprintf("Sno");
gotoxy(5,7);
cprintf("D_of_Travel");
gotoxy(18,7);
cprintf("B_Number");
gotoxy(29,7);
cprintf("Name");
gotoxy(43,7);
cprintf("Address");
gotoxy(57,7);
cprintf("Source");
gotoxy(69,7);
cprintf("Destination");
textcolor(WHITE);
gotoxy(1,8);
cout<<"--------------------------------------------------------
------------------------";
fin.seekg(0,ios::beg);
while(fin.read((char*)&mun,sizeof(mun))!=0)
{
gotoxy(2,m);
cout<<mun.snum;
gotoxy(5,m);
cout<<strupr(mun.pdate);
gotoxy(18,m);
cout<<strupr(mun.number);
gotoxy(29,m);
cout<<strupr(mun.name);
gotoxy(43,m);
cout<<strupr(mun.padd);
gotoxy(57,m);
cout<<strupr(mun.source);
gotoxy(69,m);
cout<<strupr(mun.desti);
m++;
}
fin.clear();

}//end of passenger_display function


/*starting of passenger_modify function definition*/
void passenger::passenger_modify()
{
clrscr();
int number1;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nPASSENGER DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter Serial No. of Details To be Modified:");
cin>>number1;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&mun,sizeof(mun)))
{
if(mun.snum!=number1)
count++;
else
{
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Serial Number :");cout<<mun.snum;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,25);
cprintf("Date of Travel :");cout<<mun.pdate;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,27);
cprintf("Bus Number :");cout<<mun.number;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Name :");cout<<mun.name;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,31);
cprintf("Address :");cout<<mun.padd;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,33);
cprintf("Source :");cout<<mun.source;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,35);
cprintf("Destination :");cout<<mun.desti;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Serial Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,23);
cin>>mun.snum;
int ck=mun.snum;
if(ck!=number1)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Make Duplicate entry";
getch();
clear3(40,38);
gotoxy(56,23);
clear3(56,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Date of Travel :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,25);
gets(mun.pdate);
ch=strlen(mun.pdate);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,25);
clear3(56,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("The Bus Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,27);
gets(mun.number);
ch=strlen(mun.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,27);
clear3(56,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Enter The Name :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,29);
gets(mun.name);
ch=strlen(mun.name);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,29);
clear3(56,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("Enter Address :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,31);
gets(mun.padd);
ch=strlen(mun.padd);
if (ch== 0 || ch>=15)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,31);
clear3(56,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("Enter Source :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,33);
gets(mun.source);
ch=strlen(mun.source);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,33);
clear3(56,33);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("The Destination:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(56,35);
gets(mun.desti);
ch=strlen(mun.desti);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(56,35);
clear3(56,35);
}
}while(!valid);
pos=count*sizeof(mun);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&mun,sizeof(mun));
gotoxy(42,38);
cout<<"Passenger Details modified....";
fin.clear();

gotoxy(73,38);
return;
}
else
return;
}
}
if(pos==0)//if record is not found
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of passenger_modify function
/*starting of passenger_del function definition*/
void passenger::passenger_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nPASSENGER DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("pol.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Serial No.To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&mun,sizeof(mun)))
{
if(mun.snum!=code1)
fin1.write((char*)&mun,sizeof(mun));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("passanger.dat");
rename("pol.dat","passanger.dat");
fin.open("passanger.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
fin.clear();
fin1.clear();

textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
}//end of passenger_del function
/*starting of passenger_query function definiton*/
void passenger::passenger_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(29,10);
cprintf("\nPASSENGER DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Serial Number To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&mun,sizeof(mun))!=0)
{
if(mun.snum!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nPASSENGER DETAILS");
textcolor(WHITE);
gotoxy(25,16);
cout<<"Quried Serial Number:"<<vac;
gotoxy(20,22);
textcolor(CYAN);
cprintf("Serial Number :");
gotoxy(20,24);
cprintf("Date of Travelling :");
gotoxy(20,26);
cprintf("Bus Number :");
gotoxy(20,28);
cprintf("Name of Passenger :");
gotoxy(20,30);
cprintf("Address of Passenger :");
gotoxy(20,32);
cprintf("Source :");
gotoxy(20,34);
cprintf("Destination :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(45,22);
cout<<mun.snum;
gotoxy(45,24);
cout<<strupr(mun.pdate);
gotoxy(45,26);
cout<<strupr(mun.number);
gotoxy(45,28);
cout<<strupr(mun.name);
gotoxy(45,30);
cout<<strupr(mun.padd);
gotoxy(45,32);
cout<<strupr(mun.source);
gotoxy(45,34);
cout<<strupr(mun.desti);
s++;
if (mun.snum==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)//if record is not found
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of pasenger_query function
/*---------------------------End of Passneger
Class------------------------*/
End of passenger class coding.

Starting of table class coding:


/*-----------------------------Starting of tabl
class------------------------*/
class table//class declaration
{
private:
int valid;
char ch;
int ch1;
fstream fin,fin1;//variable declaration of fstream
/*declaration of struct for data with their data types*/
struct table1
{
int sn;
char number[12];
char desti[15];
char dtn[10];
float charge;
char source[15];
char dtime[10];
}teb;//end of struct declaration
public:
table()//constructor declaration
{
fin.open("table.dat",ios::in|ios::out|ios::binary|
ios::ate);
if(!fin)
{
gotoxy(22,22);
cout<<"Unable To Open File";
getch();
exit13();
}
teb.sn=0;//intialization of serial number
}
~table()//destructor declaration
{
fin.close();//closing of file stream
delete
teb.number,teb.desti,teb.dtn,teb.source,teb.dtime;//deletion of
struct data explicitly
}
/*starting of function declaration*/
void table_entry();
void table_display();
void table_modify();
void table_del();
void table_menu();
void table_query();
void table_save();
void exit13();
/*end of function declaration*/
};//end of function declaration
/*starting of table_menu function definition body*/
void table::table_menu()
{
tebco:
clrscr();
char tb;
screen3();
gotoxy(28,15);
textcolor(CYAN);
cprintf("ROADWAYS DEPARTMENT");
gotoxy(27,17);
cprintf("Time-Table Division");
screen1();
textcolor(GREEN);
gotoxy(25,21);
cprintf("[1] Time_Table Entry");//for record entry
gotoxy(25,24);
cprintf("[2] Time_Table Details");//for data show/report
generation
gotoxy(25,27);
cprintf("[3] Time_Table Modifiction");//for modification of
details
gotoxy(25,30);
cprintf("[4] Time_table Deletion");//for deletion of records
gotoxy(25,33);
cprintf("[5] Query for Time-Table details");//for query of
details
gotoxy(25,36);
cprintf("[6] Return To RoadWays Department Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,38);
cprintf("Enter Your Choice:");
textcolor(WHITE);
tb=getch();
switch(tb)
{
case '1'://calling of table_entry function
clrscr();
table_entry();
tme:
gotoxy(21,42);
textcolor(RED+BLINK);
cprintf("HOT KEY: TO MORE ENTRY (PRESS KEY:1)");
gotoxy(21,44);
cprintf("HOT KEY:TO EXIT (PRESS KEY:2)");
textcolor(WHITE);
char tb1;
cin>>tb1;
switch(tb1)
{
case '1'://for more entry
table_entry();
goto tme;
case '2':
goto tebco;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto tme;
}
case '2'://calling of table_display function
table to;
to.table_display();
getch();
goto tebco;
case '3'://calling of table_modify function
table to1;
to1.table_modify();
getch();
goto tebco;
case '4'://calling of table_del function
table to2;
to2.table_del();
getch();
goto tebco;
case '5'://calling of table_query function
table to3;
to3.table_query();
getch();
goto tebco;
case '6':
break;
default:
gotoxy(21,46);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto tebco;
}
}//end of table_menu function definition
/*starting of table_save function definition body*/
void table::table_save()
{
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(0,ios::end);
fin.write((char*)&teb,sizeof(teb));
gotoxy(23,38);
cout<<"Time-Table Details Entered.....";
teb.sn++;//incrementation of serial number
clear(25,42);
gotoxy(55,38);
}
else
gotoxy(56,42);
return;
}//end of function definition
void table::exit13()//function for error handling
{
fin.close();
}
/*starting of table_entry function definition body*/
void table::table_entry()
{
clrscr();
screen2();
gotoxy(34,6);
textcolor(RED);
cprintf("\nENTRY FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(23,10);
cprintf("\nTIME-TABLE FOR ROADWAYS PURPOSE");
textcolor(WHITE);
screen1();
textcolor(CYAN);
gotoxy(18,22);
cprintf("Serial Number :");
gotoxy(18,24);
cprintf("Enter The Bus Number :");
gotoxy(18,26);
cprintf("Departure time From source :");
gotoxy(18,28);
cprintf("Enter The Source From Go :");
gotoxy(18,30);
cprintf("Enter The Destination :");
gotoxy(18,32);
cprintf("Departure Time From Destination :");
gotoxy(18,34);
cprintf("Enter The Government Charge :");
textcolor(WHITE);
fin.seekp(0,ios::end);
gotoxy(52,22);
cout<<teb.sn;//serial number shows through constructor
/* error handling during data entry*/
do
{
valid=1;
gotoxy(52,24);
gets(teb.number);
ch=strlen(teb.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,24);
clear(52,24);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,26);
gets(teb.dtime);
ch=strlen(teb.dtime);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,26);
clear(52,26);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,28);
gets(teb.source);
ch=strlen(teb.source);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,28);
clear(52,28);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,30);
gets(teb.desti);
ch=strlen(teb.desti);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,30);
clear(52,30);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,32);
gets(teb.dtn);
ch=strlen(teb.dtn);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip(or Make More) This Entry";
getch();
clear(18,38);
gotoxy(52,32);
clear(52,32);
}
}while(!valid);
do
{
valid=1;
gotoxy(52,34);
cin>>teb.charge;
ch1=teb.charge;
if (ch1== 0 )
{
valid=0;
gotoxy(18,38);
cout<<"You Can Not Skip This Entry";
getch();
clear(18,38);
gotoxy(52,34);
clear(52,34);
}
}while(!valid);
/*end of error handling*/
table_save();//calling of table_save function for user need
getch();
}//end of function definition
/*starting of table_display function definition body*/
void table::table_display()
{
clrscr();
textcolor(RED);
int m=9;
gotoxy(22,2);
cprintf("THE TRAVEL AND TRANSPORT AGENCY");
gotoxy(25,4);
cprintf("Time_Table Details");
textcolor(WHITE);
gotoxy(1,6);
cout<<"--------------------------------------------------------
------------------------";
gotoxy(2,7);
textcolor(BLUE);
cprintf("S_no");

gotoxy(7,7);
cprintf("Bus_No.");
gotoxy(19,7);
cprintf("dep_time_sc");
gotoxy(31,7);
cprintf("source");
gotoxy(45,7);
cprintf("Destination");
gotoxy(61,7);
cprintf("dep_time_des");
gotoxy(74,7);
cprintf("Charge");
textcolor(WHITE);
gotoxy(1,8);
cout<<"--------------------------------------------------------
------------------------";
fin.seekg(0,ios::beg);
while(fin.read((char*)&teb,sizeof(teb))!=0)
{
gotoxy(2,m);
cout<<teb.sn;
gotoxy(7,m);
cout<<strupr(teb.number);
gotoxy(22,m);
cout<<strupr(teb.dtime);
gotoxy(31,m);
cout<<strupr(teb.source);
gotoxy(45,m);
cout<<strupr(teb.desti);
gotoxy(64,m);
cout<<strupr(teb.dtn);
gotoxy(75,m);
cout<<teb.charge;
m++;
}
}//end of function definition
/*starting of table_modify function definition body*/
void table::table_modify()
{
clrscr();
int number1;
screen2();
gotoxy(31,6);
textcolor(RED);
cprintf("\nMODIFICATION fORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(28,10);
cprintf("\nTIME-TABLE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,21);
cprintf("Enter Serial No. of Bus To be Modified:");
cin>>number1;
clear(20,21);
clear1();
int pos=0,count=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&teb,sizeof(teb)))
{
if(teb.sn!=number1)
count++;
else
{
scoot();
textcolor(GREEN);
gotoxy(10,21);
cprintf("Old Value");
gotoxy(10,22);
cout<<"---------";
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,23);
cprintf("Serial Number :");cout<<teb.sn;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,25);
cprintf("Bus Number :");cout<<teb.number;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,27);
cprintf("Time From Source:");cout<<teb.dtime;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,29);
cprintf("Source From Go :");cout<<teb.source;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,31);
cprintf("Desination :");cout<<teb.desti;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,33);
cprintf("Time From Desti.:");cout<<teb.dtn;
textcolor(WHITE);
textcolor(CYAN);
gotoxy(5,35);
cprintf("Charge :");cout<<teb.charge;
textcolor(WHITE);
scoot1();
textcolor(GREEN);
gotoxy(48,21);
cprintf("Enter New Value");
gotoxy(48,22);
cout<<"---------------";
textcolor(WHITE);
gotoxy(40,23);
textcolor(CYAN);
cprintf("Serial Number :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,23);
cin>>teb.sn;
int ck=teb.sn;
if(ck!=number1)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Make Duplicate entry";
getch();
clear3(40,38);
gotoxy(57,23);
clear3(57,23);
}
}while(!valid);
gotoxy(40,25);
textcolor(CYAN);
cprintf("Enter Bus Number:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,25);
gets(teb.number);
ch=strlen(teb.number);
if (ch== 0 || ch>=12)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,25);
clear3(57,25);
}
}while(!valid);
gotoxy(40,27);
textcolor(CYAN);
cprintf("Time From Source:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,27);
gets(teb.dtime);
ch=strlen(teb.dtime);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,27);
clear3(57,27);
}
}while(!valid);
gotoxy(40,29);
textcolor(CYAN);
cprintf("Enter The Source:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,29);
gets(teb.source);
ch=strlen(teb.source);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,29);
clear3(57,29);
}
}while(!valid);
gotoxy(40,31);
textcolor(CYAN);
cprintf("The Destination :");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,31);
gets(teb.desti);
ch=strlen(teb.desti);
if (ch== 0 || ch>=17)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,31);
clear3(57,31);
}
}while(!valid);
gotoxy(40,33);
textcolor(CYAN);
cprintf("Time From Desti.:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,33);
gets(teb.dtn);
ch=strlen(teb.dtn);
if (ch== 0 || ch>=10)
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip(or Make More)Entry";
getch();
clear3(40,38);
gotoxy(57,33);
clear3(57,33);
}
}while(!valid);
gotoxy(40,35);
textcolor(CYAN);
cprintf("Enter The Charge:");
textcolor(WHITE);
do
{
valid=1;
gotoxy(57,35);
cin>>teb.charge;
ch1=teb.charge;
if (ch1== 0 )
{
valid=0;
gotoxy(40,38);
cout<<"You Can Not Skip This Entry";
getch();
clear3(40,38);
gotoxy(57,35);
clear3(57,35);
}
}while(!valid);
pos=count*sizeof(teb);
textcolor(RED+BLINK);
gotoxy(25,42);
cprintf("Are You Sure To Save It(y/n):");
ch=getche();
textcolor(WHITE);
if (ch == 'y')
{
fin.seekp(pos,ios::beg);
fin.write((char*)&teb,sizeof(teb));
gotoxy(42,38);
cout<<"Time-Table Details modified....";
gotoxy(74,38);
return;
}
else
return;
}
}
if(pos==0)//if record is not found
gotoxy(20,42);
cout<<"Record Not Found ! Try Again..... ";
fin.clear();
}//end of function definition
/*stating of table_del function definiton body*/
void table::table_del()
{
clrscr();
screen2();
textcolor(RED);
cprintf("\nDELETION FORM\n");
gotoxy(39,8);

cprintf("\nOF");
gotoxy(30,10);
cprintf("\nTIME-TABLE DETAILS");
textcolor(WHITE);
screen4();
int code1;
fin1.open("too.dat",ios::out);
gotoxy(23,24);
cprintf("Enter The Serial No.To be Deleted:");
cin>>code1;
fin.seekg(0,ios::beg);
int found1=0;
while(fin.read((char*)&teb,sizeof(teb)))
{
if(teb.sn!=code1)
fin1.write((char*)&teb,sizeof(teb));
else
found1=1;
}
if(found1==0)
{
gotoxy(25,31);
cout<<"Record is Not Found! Try Again...";
fin.clear();
}
else if(found1==1)
{
fin.close();
fin1.close();
remove("table.dat");
rename("too.dat","table.dat");
fin.open("table.dat",ios::in|ios::out|ios::binary);
gotoxy(25,29);
cout<<"Record Has been Successfully Deleted...";
textcolor(RED+BLINK);
gotoxy(32,38);
cout<<"Press Any To Exit:";
textcolor(WHITE);
}
}//end of function definition
/*starting of table_query function definition body*/
void table::table_query()
{
clrscr();
int vac;
screen2();
gotoxy(32,6);
textcolor(RED);
cprintf("\nQUERY FORM\n");
gotoxy(36,8);
cprintf("\nOF");
gotoxy(30,10);
cprintf("\nTIME-TABLE DETAILS");
textcolor(WHITE);
screen4();
gotoxy(20,22);
cprintf("Enter The Serial Number To Make Query:");
cin>>vac;
clear1();
int co=0;
fin.seekg(0,ios::beg);
while(fin.read((char*)&teb,sizeof(teb))!=0)
{
if(teb.sn!=vac)
co++;
else
{
clrscr();
int s=1;
screen2();
screen1();
gotoxy(30,6);
textcolor(RED);
cprintf("\nQUERY RESULT FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(31,10);
cprintf("\nTIME-TABLE DETAILS");
textcolor(WHITE);
gotoxy(29,16);
cout<<"Quried Serial Number:"<<vac;
gotoxy(20,21);
textcolor(CYAN);
cprintf("Serial Number :");
gotoxy(20,24);
cprintf("Bus Number :");
gotoxy(20,27);
cprintf("Departure Time From Source :");
gotoxy(20,30);
cprintf("Source :");
gotoxy(20,33);
cprintf("Destination :");
gotoxy(20,36);
cprintf("Departure Time From Destination:");
gotoxy(20,39);
cprintf("Government Charge :");
textcolor(WHITE);
fin.seekg(0,ios::beg);
gotoxy(52,21);
cout<<teb.sn;
gotoxy(52,24);
cout<<strupr(teb.number);
gotoxy(52,27);
cout<<strupr(teb.dtime);
gotoxy(52,30);
cout<<strupr(teb.source);
gotoxy(52,33);
cout<<strupr(teb.desti);
gotoxy(52,36);
cout<<strupr(teb.dtn);
gotoxy(52,39);
cout<<teb.charge;
s++;
if (teb.sn==vac)
{
return;
}
textcolor(WHITE);
flush(fin);
}
}
if(co==0)//if record is not found
gotoxy(10,30);
gotoxy(24,42);
cout<<"Record Not Found! Try Again..... ";
fin.clear();
return;
}//end of table_query function definition
/*--------------------------End of Table
Class-------------------------*/

End of table class coding.

Here I am adding the coding of that functions that is used by this project for Interface

Designing and for more other task.

Coding of screen function:


D:\gaurav\box.cpp
void screen()
{
int i,c=11,r=5;
/*-----Starting of Box Generation-----*/
for(i=1;i<=62;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
r=13;c=11;
for(i=1;i<=62;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
gotoxy(11,5);
cprintf("%c",201);
gotoxy(72,5);
cprintf("%c",187);
gotoxy(11,13);
cprintf("%c",200);
gotoxy(72,13);
cprintf("%c",188);
r=6;
c=11;
for(i=1;i<=7;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
r=6;
c=72;
for(i=1;i<=7;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
gotoxy(21,6);
textcolor(RED);
cprintf("\nTHE TRAVEL AND TRANSPORT MANAGEMENT SYSTEM\n");
gotoxy(39,8);
cprintf("\nOF\n");
gotoxy(23,10);
cprintf("\nAMAR JYOTI TRAVEL AND TRANSPORT AGENCY");
textcolor(WHITE);
/*-----End of Screen Generation-----*/
}

Starting of Screen1 function coding.


d:\gaurav\box1.cpp

void screen1()
{
textcolor(BLUE);
int i,c=13,r=19;
/*-----Starting of Box generation-----*/
for(i=1;i<=58;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
r=40,c=13;
for(i=1;i<=58;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
gotoxy(13,19);
cprintf("%c",201);
gotoxy(70,19);
cprintf("%c",187);
gotoxy(13,40);
cprintf("%c",200);
gotoxy(70,40);
cprintf("%c",188);
r=20;
c=13;
for(i=1;i<=20;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
r=20;
c=70;
for(i=1;i<=20;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
textcolor(WHITE);
/*-----End of Box Generation-----*/
}
Starting of screen2 function coding;
d:\gaurav\box2.cpp
void screen2()
{
textcolor(CYAN);
int i,c=11,r=3;
/*-----Box Generation-----*/
for(i=1;i<=62;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
r=13;c=11;
for(i=1;i<=62;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
gotoxy(11,3);
cprintf("%c",201);
gotoxy(72,3);
cprintf("%c",187);
gotoxy(11,13);
cprintf("%c",200);
gotoxy(72,13);
cprintf("%c",188);
r=4;
c=11;
for(i=1;i<=9;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
r=4;
c=72;
for(i=1;i<=9;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
gotoxy(21,4);
textcolor(RED);
cprintf("\nTHE TRAVEL AND TRANSPORT MANAGEMENT SYSTEM\n");
gotoxy(34,6);
/* cprintf("\nENTRY FORM\n");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(32,10);
cprintf("\nBUDGET DETAILS");*/
textcolor(WHITE);
/*-----End of Screen-----*/
}
Starting of screen3 function coding:
d:\gaurav\box3.cpp
void screen3()
{
int i,c=11,r=5;
/*-----Starting of Box Generation-----*/
for(i=1;i<=62;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
r=13;c=11;
for(i=1;i<=62;i++)
{
gotoxy(c,r);
cprintf("%c",205);

c++;
}
gotoxy(11,5);
cprintf("%c",201);
gotoxy(72,5);
cprintf("%c",187);
gotoxy(11,13);
cprintf("%c",200);
gotoxy(72,13);
cprintf("%c",188);
r=6;
c=11;
for(i=1;i<=7;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
r=6;
c=72;
for(i=1;i<=7;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
c=11,r=13;
for(i=1;i<=3;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
gotoxy(11,16);
cprintf("%c",200);
c=12,r=16;
for(i=1;i<=61;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
gotoxy(72,16);
cprintf("%c",188);
c=72,r=13;
for(i=1;i<=3;i++)

{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
gotoxy(21,6);
textcolor(RED);
cprintf("\nTHE TRAVEL AND TRANSPORT MANAGEMENT SYSTEM\n");
gotoxy(39,8);
cprintf("\nOF\n");
gotoxy(23,10);
cprintf("\nAMAR JYOTI TRAVEL AND TRANSPORT AGENCY");
textcolor(WHITE);
/*-----End of box Screen generation-----*/
}
Starting of screen4 function coding;
d:\gaurav\dbox.cpp
void screen4()
{
int i,c=17,r=19;
/*-----starting of Box generation-----*/
for(i=1;i<=49;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
r=34,c=17;
for(i=1;i<=49;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
gotoxy(17,19);
cprintf("%c",201);
gotoxy(66,19);
cprintf("%c",187);
gotoxy(17,34);
cprintf("%c",200);
gotoxy(66,34);
cprintf("%c",188);
r=20,c=17;
for(i=1;i<=14;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
r=20,c=66;
for(i=1;i<=14;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
/*-----End of Box generation-----*/
}
Starting of clear function:
d:\gaurav\clear.cpp
void clearscreen(int col,int row)
{
for(int i=col;i<=80;i++)
{
gotoxy(i,row);
textbackground(BLACK);
cprintf("");
}
}
Starting of clear function:
d:\gaurav\clear1.cpp
void clear1()
{
int c,r,i;
c=17,r=19;
for(i=1;i<=49;i++)
{
gotoxy(c,r);
cprintf(" ");
c++;
}
c=17,r=34;
for(i=1;i<=49;i++)
{
gotoxy(c,r);
cprintf(" ");
c++;
}
gotoxy(17,19);
cprintf(" ");
gotoxy(66,19);
cprintf(" ");
gotoxy(17,34);
cprintf(" ");
gotoxy(66,34);
cprintf(" ");
r=20,c=17;
for(i=1;i<=14;i++)
{
gotoxy(c,r);
cprintf(" ");
r++;
}
r=20,c=66;
for(i=1;i<=14;i++)
{
gotoxy(c,r);
cprintf(" ");
r++;
}
}
Starting of clear function:
d:\gaurav\clear2.cpp
void clear(int col,int row)
{
for(int i=col;i<=68;i++)
{
gotoxy(i,row);
cprintf(" ");
}
}
Starting of clear3 function:
d:\gaurav\clear3.cpp
void clear3(int col,int row)
{
for(int i=col;i<=77;i++)
{
gotoxy(i,row);
cprintf(" ");
}
}
Starting of Help function coding:
d:\gaurav\help.cpp

void help()
{
int c=13,r=14;
/*---------------Starting of help Box Generation---------------
*/
for(int i=1;i<=58;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
r=42,c=13;
for(i=1;i<=58;i++)
{
gotoxy(c,r);
cprintf("%c",205);
c++;
}
gotoxy(13,14);
cprintf("%c",201);
gotoxy(70,14);
cprintf("%c",187);
gotoxy(13,42);
cprintf("%c",200);
gotoxy(70,42);
cprintf("%c",188);
r=15;
c=13;
for(i=1;i<=27;i++)
{
gotoxy(c,r);

cprintf("%c",186);
r++;
}
r=15;
c=70;
for(i=1;i<=27;i++)
{
gotoxy(c,r);
cprintf("%c",186);
r++;
}
}
/*-------------End of Help Box Generation---------------*/
End of Help function code.
Starting of password class coding:
#include<iostream.h>
#include<process.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#include<fstream.h>
#include<stdlib.h>
#define NAME_LENGTH 14
#define PASS_LENGTH 14
void msgbox();//declaration of function msgbox()
/*---------------------------Starting of Password
Class------------------*/
class password//class declaration
{
private:
struct pass3//structure declaration for user name and
password
{
char name[15];
char password[15];
}pass;//end of declaration
fstream file;//declaration of fstream variable
public:
password();//constructor
/*declaration of function*/
int login();
void change_password();
void change_user();
void entry();
void menu();
/*end of function declaration*/
~password()//destructor
{
file.close();
}
};
/*starting of menu function*/
void password::menu()
{
repa3:
clrscr();
screen2();
gotoxy(33,6);
textcolor(RED);
cprintf("\nPASSWORD FORM");
gotoxy(38,8);
cprintf("\nOF");
gotoxy(21,10);
cprintf("\nTHE TRAVEL AND TRANSPORT MANAGEMENT SYSTEM");
textcolor(WHITE);
screen4();
textcolor(5);
gotoxy(24,23);
cprintf("1.Change of Password");//for change of password
gotoxy(24,26);
cprintf("2.Change User Name");//for change of user name
gotoxy(24,29);
cprintf("3.Return to Main Menu");
textcolor(YELLOW+BLINK);
gotoxy(25,31);
cprintf("Enter Your Choice:");
textcolor(WHITE);
char ch=getch();;
switch(ch)
{
case '1':
clrscr();
password poo;
poo.change_password();
getch();
goto repa3;
case '2':
clrscr();
password poo1;
poo1.change_user();
getch();
goto repa3;
case '3':
break;
default :
gotoxy(21,42);
textcolor(BLUE+BLINK);
cprintf("Invalid Choice,Please retry!!");
textcolor(WHITE);
getch();
goto repa3;
}
}//end of menu function body
/*starting of change_user function*/
void password::change_user()
{
msgbox();
int pos1=0,count1=0;
char usr[14],p,r;
gotoxy(34,9);
textcolor(BLUE);
cprintf("Change User Name");
textcolor(CYAN);
gotoxy(26,12);
cprintf("Enter the old User Name:");
gotoxy(51,12);
cprintf(" ");
gotoxy(51,12);
cin>>usr;
textcolor(WHITE);
file.seekg(0,ios::beg);
while(file.read((char*)&pass,sizeof(pass))!=0)
{
if (strcmp(pass.name,usr)==0)
{
textcolor(CYAN);
gotoxy(26,15);
cprintf("Enter New User Name :");
gotoxy(51,15);
cprintf(" ");
textcolor(WHITE);
gotoxy(51,15);
cin>>pass.name;
pos1=count1*sizeof(pass);
file.seekp(pos1,ios::beg);
file.write((char*)&pass,sizeof(pass));
gotoxy(29,18);
cout<<"Your User Name is modified Now...";
return;
}
else
{
count1++;
if(pos1==0)
gotoxy(29,18);
cout<<"User Name is Not Matched..";
getch();
file.clear();
}
}
}//end of function body
/*starting of change_password function*/
void password::change_password()
{
clrscr();
msgbox();
int pos=0,count=0;
char pop[14],m,n;
gotoxy(34,9);
textcolor(BLUE);
cprintf("Password Change");
textcolor(CYAN);
gotoxy(26,12);
cprintf("Enter the old password:");
gotoxy(50,12);
cprintf(" ");
gotoxy(50,12);
for(int l=0;l<8;l++)
{
m=getch();
pop[l]=m;
cout<<"*";
if(m==13)
{
pop[l]='\0';
break;
}
}
textcolor(WHITE);
file.seekg(0,ios::beg);
while(file.read((char*)&pass,sizeof(pass))!=0)
{
if (strcmp(pass.password,pop)==0)
{
textcolor(CYAN);
gotoxy(26,15);
cprintf("Enter New Password :");
gotoxy(50,15);
cprintf(" ");
textcolor(WHITE);
gotoxy(50,15);
for(int k=0;k<8;k++)
{
n=getch();
pass.password[k]=n;
cout<<"*";
if(n==13)
{
pass.password[k]='\0';
break;
}
}
pos=count*sizeof(pass);
file.seekp(pos,ios::beg);
file.write((char*)&pass,sizeof(pass));
gotoxy(29,18);
cout<<"Your Password is modified Now....";
return;
}
else
{
count++;
if(pos==0)
gotoxy(29,18);
cout<<"Password is Not Matched..";
getch();
file.clear();
}
}
}//end of function body
/*starting of constructor definition*/
void password::password()
{
file.open("password.dat",ios::in|ios::out|ios::binary);
if(!file)
{
cout<<endl<<"Unable to Password File";
exit(0);
}
}//end of definition
/*starting of entry function for first time entering password and
user name*/
void password::entry()
{
clrscr();
cout<<endl<<"Enter Name:";
cin>>pass.name;
cout<<endl<<"Enter Password:";
cin>>pass.password;
file.seekp(0L,ios::end);
file.write((char*)&pass,sizeof(pass));
}//end of function definition
/*starting of login function*/
int password::login()
{
char t,name1[15];
char passwd[15];
int i,l,flag,j,flag1;
j=0;
for(i=0;i<3;i++)
{
clrscr();
textbackground(BLACK);
textcolor(WHITE);
msgbox();
gotoxy(38,9);
textcolor(BLUE);
cprintf("Login");
textbackground(LIGHTBLUE);
textcolor(WHITE);
textcolor(CYAN);
gotoxy(26,12);
cprintf("Login Name :");
gotoxy(41,12);
cprintf(" ");
gotoxy(26,15);
cprintf("Password :");
gotoxy(41,15);
cprintf(" ");
textcolor(WHITE);
gotoxy(41,12);
cin>>name1;
gotoxy(41,15);
for(l=0;l<8;l++)
{
t=getch();
passwd[l]=t;
cout<<"*";
if(t==13)
{
passwd[l]='\0';
break;
}
}
textbackground(BLACK);
file.seekg(0,ios::beg);
while(file.read((char*)&pass,sizeof(pass)))
{
if(strcmp(pass.name,name1)==0)
{
if(strcmp(pass.password,passwd)==0)
{
gotoxy(29,18);
cout<<"password Matched,Press Any key.....";
getch();
j=1;
break;
}
else
{
gotoxy(29,18);
cout<<"Password Error";
getch();
}
}
else
{
gotoxy(26,18);
cout<<"User Name is Incorrect ";
getch();
}
}

file.clear();
if(j==1)
break;
}
if(j==1)
return 1;
else
return 0;
}//end of function body
/*creation of msgbox function*/
void msgbox()
{
clrscr();
int i,j,c=24,r=7;
for(i=c;i<=65;i++)
{
gotoxy(c,r);
cprintf("%c",205);
gotoxy(c,20);
cprintf("%c",205);
c++;
}
gotoxy(24,7);
cprintf("%c",201);
gotoxy(65,7);
cprintf("%c",187);
gotoxy(24,20);
cprintf("%c",200);
gotoxy(65,20);
cprintf("%c",188);
r=8;
c=24;
for(i=1;i<=12;i++)
{
gotoxy(c,r);
cprintf("%c",186);
gotoxy(65,r);
cprintf("%c",186);
r++;
}
textbackground(RED);
for(i=25;i<=64;i++)
for(j=8;j<=19;j++)
{
gotoxy(i,j);
cprintf(" ");
}
textbackground(BLACK);
textcolor(WHITE);
}//end of function

You might also like