Beruflich Dokumente
Kultur Dokumente
h>
#include<conio.h>
#include<process.h>
int main()
{clrscr();
char ch;
float l,b,area,perimeter;
cout<<"\n rectangle menu";
cout<<"\n 1.Area";
cout<<"\n 2.Perimeter";
cout<<"\n 3.exit"<<"\n";
cout<<"enter your choice";
do
{cin>>ch;
if((ch=='1')||(ch=='2'))
{
cout<<"enter the value of length and breadth";
cin>>l>>b;}
switch(ch)
{ case'1':area=l*b;
cout<<"area"<<area;
break;
case'2':perimeter=2*(l+b);
cout<<"perimeter"<<perimeter;
break;
default:cout<<"wrong menu";
cout<<"\n want to continue(y/n)?";
cin>>ch;}}
while((ch=='y')||(ch=='y'));
return 0;
}
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int n;
cout<<"enter the employee number";
cin>>n;
{if((n>=26)&&(n<=35))
cout<<"the age group b/w 26-35";
else
cout<<"not in range";}
{if((n>=36)&&(n<=45))
cout<<"the age group b/w 36-45";
else
cout<<"not in range";}
{if((n>=46)&&(n<=55))
cout<<"the age group b/w 46-55";
else
cout<<"not in range"; }
getch();}
#include<iostream.h>
#include<conio.h>
}
void main()
{clrscr();
int a[5];
int sum;
//int *ptr=&a[0];
//int *sum=∑
cout<<"enter the element::\n";
for(int i=0;i<5;i++)
cin>>a[i];
func(a,sum)
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int pnum[5]={1,2,3,4,5};
int sum;
int *ptr=&pnum[0];
int *psum=∑
for(int i=0;i<5;i++)
*psum=(*psum)+(*ptr);
ptr=ptr+1;
cout<<"Sum is::"<<*psum;
getch();
}
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
void oper()
{cout<<"\nOperator:\n";
cout<<"It is defined as the operations are representd by the operators and the
objects are referred to as operand\n\n";
}
void arith()
{ int ch;
cout<<"Arithmetic operators\n";
delay(1200);
cout<<"It provides operations for five basic arithmetic
calculations:addition,subtraction,multiplication,division and remainder
respectively.\n";
cout<<"There are different types of operators\n";
delay(1200);
cout<<"1.Unary Operators\n2.Binary operators\n3.Ternary operators \n4.logical
operators\n5.Type conversion\n6.exit\n";
cout<<"enter your choice\n";
cin>>ch;
switch(ch)
{case 1:cout<<"unary Operators\n";
cout<<"It act upon one operands\n";
cout<<"Example implementing all unary operators\n";
int n,i=1,sum=0;
cout<<"enter the value of n:";
cin>>n;
cout<<"n first"<<n<<"natural numbers are :nn";
do
{
cout<<i;
sum=sum+i;
i++;
}
while(i<=n);
cout<<"nn sum="<<sum;
break;
case 2:cout<<"Binary operators\n";
cout<<"It act on two operand \n";
cout<<"Exampal implementing all binary Operators\n";
char choi;
float l,b,area,perimeter;
cout<<"\n rectangle menu";
cout<<"\n 1.Area";
cout<<"\n 2.Perimeter";
cout<<"\n 3.exit"<<"\n";
cout<<"enter your choice";
do
{cin>>choi;
if((choi=='1')||(choi=='2'))
{
cout<<"enter the value of length and breadth";
cin>>l>>b;}
switch(choi)
{ case'1':area=l*b;
cout<<"area"<<area;
break;
case'2':perimeter=2*(l+b);
cout<<"perimeter"<<perimeter;
break;
default:cout<<"wrong menu";
cout<<"\n want to continue(y/n)?";
cin>>choi;}}
while((choi=='y')||(choi=='y'));
break;
case 3:cout<<"Ternary operators\n";
cout<<"It act upon three operands\n";
break;
case 4:cout<<"Logical operators \n";
cout<<"These are ||(logical Or),&&(Logical AND) and! (logical NOT)\n";
cout<<"Example implementing logical operators\n";
int rem;
cout<<"enter the number";
cin>>n;
while(n!=0)
{
rem=n%10;
sum+=rem;
n/=10;
}
cout<<"the sum of the digits of the number is "<<sum;
break;
case 5:char chi;
cout<<"Type conversion\n";
cout<<"It is a process of converting one predefined type into another\n";
cout<<"There are two types of conversion \n";
cout<<"a.Implicit type conversion\nb.Explicit type conversion\n";
cin>>chi ;
switch(chi)
{case 'a':cout<<"Implicit type conversion\n";
cout<<"It is a conversion performed by the compiler without programmer's
intervention.\n";
break;
case 'b':cout<<"Explicit type conversion\n";
cout<<"It is user defined that forces an expression to be of specific type\n";
break;
default :cout<<"wrong choice\n";
}
}
}
void main()
{clrscr();
cout<<"Chapter 8:Operators and expression in c++\n";
oper();
arith();
getch();
}
#include<iostream.h>
#include<conio.h>
#include<dos.h>
void main()
{clrscr();
cout<<"OBJECT ORIENTED PROGRAMMING CONCEPTS \n";
behavior (changing gear, applying brakes). Identifying the state and behavior for
realworld objects is a great way to begin thinking in terms of object-oriented
programming. These real-world observations all translate into the world of
object-oriented programming. Software objects are conceptually similar to realworld objects: they too consist of state and related behavior. An object stores its
state in fields (variables in some programming languages) and exposes its
behavior through functions\n";
getch();
}
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
void func(int ch)
{cout<<"There are different types of tokens in c++ these are:\n";
cout<<"1:Keywords\n"<<"2:identifires\n"<<"3:Literals\n"<<"4:Punctuators\n"<
<"5:Operators\n";
cout<<"Enter your choice\t\n";
cin>>ch;
switch(ch)
{case 1:int y;
cout<<"keywords\n";
cout<<"keywords are the words that convey a special meaning to the
language compiler.These are reserved for special purpose and must not be use
as normal identifier name.";
break;
case 2:cout<<"identifire\n";
cout<<"Identifire are fundamental building blocks of a program and are used as
the general terminology for the names";
cout<<"\t given to different parts of the program
viz.variables,objects,classes,functions,etc";
break;
case 3:char ch;
cout<<"Literals\n";
cout<<"Literals are data items that never change their value during a program
run\n";
cout<<"literals are of various types\n";
cout<<"a.Bool literals\n"<<"b.Interger constant\n"<<"c.character
constant\n"<<"d.Floating constant\n"<<"e.String literals\n";
cout<<"Enter your choice\t";
cin>>ch;
switch(ch)
{case 'a':cout<<"Bool literals\n";
cout<<"The bool literals in c++ is used to represent one of the two
boolean values i.e true or false.\n";
break;
textmode(C80);
cout<<"\nW-\aE-\aL-\aC-\aO-\aM-\aE-\a T\a-O\a C\a-H\a-A\a-P\a-T\a-E\a-R\a=
6"<<"\n\t\t\t"<<"GETTING "<<"\n\t\t\t\t"<<"STARTED"<<"\n\t\t\t\t\t"<<" WITH
"<<"\n\t\t\t\t"<<"C++"<<"\n";
char ch;
delay(900);
cout<<char(6)<<"\n\t"<<char(3)<<"\n";
func(ch);
getch();
}
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>
class DRAW
{
public :
void LINE_HOR(int, int, int, char) ;
void LINE_VER(int, int, int, char) ;
void BOX(int,int,int,int,char) ;
};
class TICKET
{
public :
void ADDITION(void) ;
void ENQUIRY(void) ;
char *FLIGHTNO(int) ;
private :
void ADD_RECORD(char[10], char[15], char[15], int, int) ;
protected :
char fltno[10], from[15], to[15] ;
int ecofair, exefair ;
};
class PASSANGER
{
public :
void ADD_RECORD(int, int, char[26], char[36], int, char, char) ;
void DELETE_TICKET(int) ;
int DELETE_FLIGHT(int) ;
void LIST(void) ;
int LAST_TICKETNO(void) ;
int SEATS(int) ;
int FOUND(int) ;
char *NAME(int) ;
protected :
char Class, name[26], address[36], sex ;
int slno, age, ticketno ;
};
{
gotoxy(column1,row) ;
cout <<c ;
}
}
void DRAW :: LINE_VER(int row1, int row2, int column, char c)
{
for ( row1; row1<=row2; row1++ )
{
gotoxy(column,row1) ;
cout <<c ;
}
}
void DRAW :: BOX(int column1, int row1, int column2, int row2, char c)
{
char ch=218 ;
char c1, c2, c3, c4 ;
char l1=196, l2=179 ;
if (c == ch)
{
c1=218 ;
c2=191 ;
c3=192 ;
c4=217 ;
l1 = 196 ;
l2 = 179 ;
}
else
{
c1=c ;
c2=c ;
c3=c ;
c4=c ;
l1 = c ;
l2 = c ;
}
gotoxy(column1,row1) ;
cout <<c1 ;
gotoxy(column2,row1) ;
cout <<c2 ;
gotoxy(column1,row2) ;
cout <<c3 ;
gotoxy(column2,row2) ;
cout <<c4 ;
column1++ ;
column2-- ;
LINE_HOR(column1,column2,row1,l1) ;
LINE_HOR(column1,column2,row2,l1) ;
column1-- ;
column2++ ;
row1++ ;
row2-- ;
LINE_VER(row1,row2,column1,l2) ;
LINE_VER(row1,row2,column2,l2) ;
}
d.LINE_HOR(2,79,6,196) ;
d.LINE_HOR(2,79,22,196) ;
textcolor(LIGHTGRAY+BLINK) ;
gotoxy(30,3) ;
cprintf("LIST OF THE FLIGHTS") ;
textcolor(LIGHTGRAY) ;
textcolor(BLACK) ; textbackground(WHITE) ;
for (int i=2; i<=79; i++)
{
gotoxy(i,5) ;
cprintf(" ") ;
}
gotoxy(2,5) ;
cprintf(" Sno. FLIGHT NO.
FAIR") ;
FROM
TO
textcolor(LIGHTGRAY) ; textbackground(BLACK) ;
int row=7, sno=1 ;
while (file.read((char *) this, sizeof(TICKET)))
{
gotoxy(4,row) ;
cout <<sno ;
gotoxy(9,row) ;
cout <<fltno ;
gotoxy(20,row) ;
cout <<from ;
gotoxy(34,row) ;
cout <<to ;
gotoxy(52,row) ;
cout <<ecofair ;
gotoxy(67,row) ;
cout <<exefair ;
row++ ;
sno++ ;
}
file.close() ;
}
void RESERVE :: RESERVATION(void)
{
clrscr() ;
ENQUIRY() ;
char t1[5], pclass, pname[26], paddress[36], psex, pfltno[10] ;
int t2, valid, page, tno, sno ;
PASSANGER p ;
tno = p.LAST_TICKETNO() + 1 ;
do
{
valid = 1 ;
gotoxy(3,23) ;
cout <<"
";
gotoxy(3,23) ;
cout <<"PRESS <ENTER> TO EXIT" ;
gotoxy(3,20) ;
cout <<"
";
gotoxy(3,20) ;
cout <<"Enter Sno. of the FLIGHT : " ;
gets(t1) ;
t2 = atoi(t1) ;
sno = t2 ;
if (strlen(t1) == 0)
return ;
if (sno < 1 || sno > 12)
{
valid = 0 ;
gotoxy(3,23) ;
cout <<"
";
gotoxy(3,23) ;
cout <<"\7ENTER CORRECTLY" ;
getch() ;
}
} while (!valid) ;
int i=1 ;
fstream file ;
file.open("TICKET.DAT", ios::in) ;
while (file.read((char *) this, sizeof(TICKET)))
{
if (sno == i)
break ;
i++ ;
}
file.close() ;
strcpy(pfltno,fltno) ;
if (p.SEATS(sno) >= 250)
{
gotoxy(5,21) ;
cout <<"\7Sorry! Seats are not available." ;
getch() ;
return ;
}
gotoxy(3,23) ;
cout <<"
";
gotoxy(3,23) ;
cout <<"E=ECONOMIC, X=EXECUTIVE or PRESS <ENTER> TO EXIT" ;
do
{
gotoxy(3,21) ;
cout <<"
";
gotoxy(3,21) ;
cout <<"By which Class you want to travel : " ;
pclass = getche() ;
pclass = toupper(pclass) ;
if (pclass == 13)
return ;
} while (pclass != 'E' && pclass != 'X') ;
clrscr() ;
gotoxy(72,3) ;
cout <<"<0>=EXIT" ;
gotoxy(34,2) ;
cout <<"RESERVATION" ;
gotoxy(5,5) ;
cout <<"NAME
:";
gotoxy(5,6) ;
cout <<"ADDRESS : " ;
gotoxy(5,7) ;
:";
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER NAME OF THE PASSANGER" ;
gotoxy(15,5) ; clreol() ;
gets(pname) ;
if (pname[0] == '0')
return ;
if (strlen(pname) < 1 || strlen(pname) > 25)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter Correctly (Range: 1..25)" ;
getch() ;
}
} while (!valid) ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER ADDRESS OF THE PASSANGER" ;
gotoxy(15,6) ; clreol() ;
gets(paddress) ;
if (paddress[0] == '0')
return ;
if (strlen(paddress) < 1 || strlen(paddress) > 35)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter Correctly (Range: 1..35)" ;
getch() ;
}
} while (!valid) ;
do
{
gotoxy(5,25) ; clreol() ;
cout <<"ENTER SEX OF THE PASSANGER" ;
gotoxy(15,7) ; clreol() ;
psex = getche() ;
psex = toupper(psex) ;
if (psex == '0')
return ;
} while (psex != 'M' && psex != 'F') ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER AGE OF THE PASSANGER" ;
gotoxy(15,8) ; clreol() ;
gets(t1) ;
t2 = atoi(t1) ;
page = t2 ;
if (t1[0] == '0')
return ;
if (page < 1 || page > 100)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7ENTER CORRECTLY" ;
getch() ;
}
} while (!valid) ;
clrscr() ;
DRAW d ;
d.BOX(15,5,66,21,'*') ;
d.LINE_HOR(16,65,7,'*') ;
gotoxy(33,6) ;
cout <<"Ticket no. " <<tno ;
gotoxy(17,9) ;
cout <<from <<" to " <<to ;
gotoxy(45,9) ;
cout <<"Flight no. " <<pfltno ;
gotoxy(20,11) ;
cout <<"Passanger Name : " <<pname ;
gotoxy(20,13) ;
cout <<"Address : " <<paddress ;
gotoxy(20,15) ;
cout <<"Sex : " <<psex ;
gotoxy(20,17) ;
cout <<"Age : " <<page ;
gotoxy(45,19) ;
if (pclass == 'E')
cout <<"Total Fair: " <<ecofair ;
else
cout <<"Total Fair: " <<exefair ;
p.ADD_RECORD(tno,sno,pname,paddress,page,psex,pclass) ;
getch() ;
}
void PASSANGER :: ADD_RECORD(int tno, int sno, char pname[26], char
paddress[36], int page, char psex, char pclass)
{
fstream file ;
file.open("PASS.DAT", ios::app) ;
ticketno = tno ;
slno = sno ;
strcpy(name,pname) ;
strcpy(address,paddress) ;
age = page ;
sex = psex ;
Class = pclass ;
file.write((char *) this, sizeof(PASSANGER)) ;
file.close() ;
}
int PASSANGER :: LAST_TICKETNO(void)
{
fstream file ;
file.open("PASS.DAT", ios::in) ;
int count=0 ;
while (file.read((char *) this, sizeof(PASSANGER)))
count = ticketno ;
file.close() ;
return count ;
}
int PASSANGER :: SEATS(int sno)
{
fstream file ;
file.open("PASS.DAT", ios::in) ;
int count=0 ;
while (file.read((char *) this, sizeof(PASSANGER)))
{
if (sno == slno)
count++ ;
}
file.close() ;
return count ;
}
break ;
}
}
file.close() ;
return found ;
}
char *PASSANGER :: NAME(int tno)
{
fstream file ;
file.open("PASS.DAT", ios::in) ;
while (file.read((char *) this, sizeof(PASSANGER)))
{
if (tno == ticketno)
break ;
}
file.close() ;
return name ;
}
void PASSANGER :: LIST(void)
{
clrscr() ;
char t1[10] ;
int t2, sno, valid ;
TICKET ticket ;
ticket.ENQUIRY() ;
do
{
valid = 1 ;
gotoxy(3,23) ;
cout <<"
";
gotoxy(3,23) ;
cout <<"PRESS <ENTER> TO EXIT" ;
gotoxy(3,20) ;
cout <<"
";
gotoxy(3,20) ;
cout <<"Enter Sno. of the FLIGHT for which you want to see list of passanger " ;
gets(t1) ;
t2 = atoi(t1) ;
sno = t2 ;
if (strlen(t1) == 0)
return ;
if (sno < 1 || sno > 12)
{
valid = 0 ;
gotoxy(3,23) ;
cout <<"
";
gotoxy(3,23) ;
cout <<"\7ENTER CORRECTLY" ;
getch() ;
}
} while (!valid) ;
clrscr() ;
int row=7, found=0, flag=0 ;
char ch ;
DRAW d ;
d.BOX(1,2,80,24,218) ;
d.LINE_HOR(2,79,4,196) ;
d.LINE_HOR(2,79,6,196) ;
d.LINE_HOR(2,79,22,196) ;
gotoxy(3,3) ;
cout <<"Flight no. " <<ticket.FLIGHTNO(sno) ;
gotoxy(32,3) ;
cout <<"LIST OF PASSANGER" ;
textcolor(BLACK) ; textbackground(WHITE) ;
gotoxy(2,5) ;
cprintf(" TICKET NO.
NAME
CLASS
textcolor(LIGHTGRAY) ; textbackground(BLACK) ;
fstream file ;
file.open("PASS.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
while (file.read((char *) this, sizeof(PASSANGER)))
{
if (sno == slno)
{
flag = 0 ;
delay(20) ;
found = 1 ;
gotoxy(5,row) ;
cout <<ticketno ;
gotoxy(17,row) ;
cout <<name ;
gotoxy(49,row) ;
if (Class == 'X')
cout <<"Executive" ;
") ;
else
cout <<"Economic" ;
if ( row == 21 )
{
flag = 1 ;
row = 7 ;
gotoxy(5,23) ;
cout <<"Press any key to continue or Press <ESC> to exit" ;
ch = getch() ;
if (ch == 27)
break ;
clrscr() ;
d.BOX(1,2,80,24,218) ;
d.LINE_HOR(2,79,4,196) ;
d.LINE_HOR(2,79,6,196) ;
d.LINE_HOR(2,79,22,196) ;
gotoxy(32,3) ;
cout <<"LIST OF PASSANGER" ;
textcolor(BLACK) ; textbackground(WHITE) ;
gotoxy(2,5) ;
cprintf(" TICKET NO.
NAME
FLIGHT NO.
textcolor(LIGHTGRAY) ; textbackground(BLACK) ;
}
else
row++ ;
}
}
if (!found)
CLASS
") ;
{
gotoxy(5,10) ;
cout <<"\7Records not found" ;
}
if (!flag)
{
gotoxy(5,23) ;
cout <<"Press any key to continue..." ;
getch() ;
}
file.close() ;
}
void PASSANGER :: DELETE_TICKET(int tno)
{
fstream file ;
file.open("PASS.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
while (!file.eof())
{
file.read((char *) this, sizeof(PASSANGER)) ;
if (file.eof())
break ;
if (tno != ticketno)
temp.write((char *) this, sizeof(PASSANGER)) ;
}
file.close() ;
temp.close() ;
file.open("PASS.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while ( !temp.eof() )
{
temp.read((char *) this, sizeof(PASSANGER)) ;
if ( temp.eof() )
break ;
file.write((char *) this, sizeof(PASSANGER)) ;
}
file.close() ;
temp.close() ;
}
int PASSANGER :: DELETE_FLIGHT(int sno)
{
fstream file ;
file.open("PASS.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
int found = 0 ;
while (!file.eof())
{
file.read((char *) this, sizeof(PASSANGER)) ;
if (file.eof())
break ;
if (sno != slno)
temp.write((char *) this, sizeof(PASSANGER)) ;
else
found = 1 ;
}
file.close() ;
temp.close() ;
file.open("PASS.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while ( !temp.eof() )
{
temp.read((char *) this, sizeof(PASSANGER)) ;
if ( temp.eof() )
break ;
file.write((char *) this, sizeof(PASSANGER)) ;
}
file.close() ;
temp.close() ;
return found ;
}
void RESERVE :: CANCELLATION(void)
{
clrscr() ;
char t1[10], ch ;
int t2, tno, valid ;
do
{
valid = 1 ;
gotoxy(3,23) ; clreol() ;
cout <<"PRESS <ENTER> TO SEE LIST or 0 TO EXIT" ;
gotoxy(3,20) ; clreol() ;
cout <<"Enter Ticket no. of the Passanger to cancel the Ticket " ;
gets(t1) ;
t2 = atoi(t1) ;
tno = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
{
valid = 0 ;
LIST() ;
clrscr() ;
}
if (!FOUND(tno) && valid)
{
valid = 0 ;
gotoxy(3,23) ; clreol() ;
cout <<"\7Record not found" ;
getch() ;
}
} while (!valid) ;
clrscr() ;
fstream file ;
file.open("PASS.DAT", ios::in) ;
{
valid = 1 ;
gotoxy(3,23) ; clreol() ;
cout <<"PRESS <ENTER> TO SEE LIST or 0 TO EXIT" ;
gotoxy(3,20) ; clreol() ;
cout <<"Enter Ticket no. of the Passanger " ;
gets(t1) ;
t2 = atoi(t1) ;
tno = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
{
valid = 0 ;
LIST() ;
clrscr() ;
}
if (!FOUND(tno) && valid)
{
valid = 0 ;
gotoxy(3,23) ; clreol() ;
cout <<"\7Record not found" ;
getch() ;
}
} while (!valid) ;
clrscr() ;
fstream file ;
file.open("PASS.DAT", ios::in) ;
";
gotoxy(3,23) ;
cout <<"PRESS <ENTER> TO EXIT" ;
gotoxy(3,20) ;
cout <<"
gotoxy(3,20) ;
";
cout <<"Enter Sno. of the FLIGHT for which all passanger records to be
deleted : " ;
gets(t1) ;
t2 = atoi(t1) ;
sno = t2 ;
if (strlen(t1) == 0)
return ;
if (sno < 1 || sno > 12)
{
valid = 0 ;
gotoxy(3,23) ;
cout <<"
";
gotoxy(3,23) ;
cout <<"\7ENTER CORRECTLY" ;
getch() ;
}
} while (!valid) ;
gotoxy(3,23) ;
if (!DELETE_FLIGHT(sno))
cout <<"\7Records not found. Press any key to continue..." ;
else
cout <<"\7Records deleted. Press any key to continue..." ;
getch() ;
}
void main(void)
{
textcolor(LIGHTBLUE+BLINK) ;
delay(2000);
cout<<"\n\n\t\t\a\aWELCOME TO COMPUTERISED AIRLINE RESERVATION SYS...";
getch();
DRAW d ;
PASSANGER p ;
TICKET ticket ;
RESERVE r ;
ticket.ADDITION() ;
char ch ;
while (1)
{
clrscr() ;
d.BOX(19,6,62,20,218) ;
textcolor(BLACK) ;
textbackground(WHITE) ;
for (int i=7; i<=19; i++)
for (int j=20; j<=61; j++)
{
gotoxy(j,i) ;
cprintf(" ") ;
}
gotoxy(29,9) ;
cprintf("AIR TICKET RESERVATION") ;
gotoxy(29,10) ;
cprintf("~~~~~~~~~~~~~~~~~~~~~~") ;
gotoxy(30,11) ;
cprintf("1: RESERVATION") ;
gotoxy(30,12) ;
cprintf("2: CANCELLATION") ;
gotoxy(30,13) ;
cprintf("3: PASSENGER RECORDS ->") ;
gotoxy(30,14) ;
cprintf("4: ENQUIRY") ;
gotoxy(30,15) ;
cprintf("5: LIST OF PASSENGERS") ;
gotoxy(30,16) ;
cprintf("6: QUIT") ;
gotoxy(30,18) ;
cprintf("ENTER YOUR CHOICE ") ;
ch = getche() ;
textcolor(LIGHTGRAY) ;
textbackground(BLACK) ;
clrscr() ;
if (ch == 27 || ch == '6')
break ;
else
if (ch == '1')
r.RESERVATION() ;
if (ch == '2')
r.CANCELLATION() ;
if (ch == '4')
{
ticket.ENQUIRY() ;
gotoxy(2,23) ;
cout <<"Press any key to continue..." ;
getch() ;
}
else
if (ch == '5')
p.LIST() ;
else
if (ch == '3')
{
while (1)
{
clrscr() ;
d.BOX(19,6,62,20,218) ;
textcolor(BLACK) ;
textbackground(WHITE) ;
for (int i=7; i<=19; i++)
for (int j=20; j<=61; j++)
{
gotoxy(j,i) ;
cprintf(" ") ;
}
gotoxy(29,10) ;
cprintf("EDIT PASSENGER RECORDS") ;
gotoxy(29,11) ;
cprintf("~~~~~~~~~~~~~~~~~~~~~~") ;
gotoxy(33,12) ;
cprintf("1: PASSANGER INFORMATION") ;
gotoxy(33,13) ;
cprintf("2: DELETE") ;
gotoxy(33,14) ;
cprintf("0: EXIT") ;
gotoxy(31,16) ;
cprintf("ENTER YOUR CHOICE ") ;
ch = getche() ;
textcolor(LIGHTGRAY) ;
textbackground(BLACK) ;
clrscr() ;
if (ch == 27 || ch == '0')
break ;
else
if (ch == '1')
r.DISPLAY_TICKET() ;
else
if (ch == '2')
r.DELETE_ALL() ;
}}}
#include<iostream.h>
#include<string.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
struct components{int ch;
char choice;}c1;
struct country{char n[20];
char c[20];
float income;
};
void inst()
{
cout<<"The structure elements of a structure can be initialised either
seperately,using separate assignment statementsorjointly using the notation
similar to array initialisation.\n";
cout<<"Example:-\nstudent.rollno=07;\nstudent.class=11;\nstudennt.marks=50
;\nstudent.grade='A';\n";
cout<<"\a\a\a\a\a\tAlternatively,the structure 'student' can be initialised by
using the notation used for array initialisation as shown below:\ns1
student={01,11,50.00.'A'};";
}
void stas()
{
cout<<"Objects of structure types can be assigned,passed as function
arguments,and returned as the result from the
function.\nExample:-\njunior_student=senior_student;\n";
cout<<"Note that one structure variable can be assigned to other only when
they are of similar data types.If not the compiler will show the
error.\nExample:-\njunoir_student=birth_date;\n";
}
void nest()
{
cout<<"A structure can be nested inside another structure,such structures are
called complex strucures.\n";
cout<<"Let us take an example for this in the following code:-\n";
cout<<"struct addr{int houseno;\nchar area[26];\nchar city[26];\nchar
state[26];};\nstruct emp{int empno;\nchar name[26];\nchar desig[16];\naddr
address;\t\\like this\nfloat basic;\n} worker;\nint main()\n{cout<<''Enter employ
number'';\ncin>>worker.empno;\ngets(worker.name);\ngets(worker.desig);\ncin>
>worker.address.houseno;\ngets(worker.address.area);\ngets(worker.address.city
);\ncin>>worker.basic;\nreturn 0;\n}\n";
}
void opt()
{
for(int i=0;i<5;++i)
{if(strcmp(c[i].n,con)==0)
cout<<"\n"<<c[i].c<<"\n"<<c[i].income;
}
}
void main()
{ clrscr();
char con[20];
country c[5];
cout<<"Chapter 13:-Structures.\n";
cout<<"A structure is a collection of similar or dissimilar data types.";
opt2(c,con);
}
else
cout<<"\a\aExiting.........................\a\a\a\a\a\a\a\a\a";
break;
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
void oper()
{cout<<"\nOperator:\n";
cout<<"It is defined as the operations are representd by the operators and the
objects are referred to as operand\n\n";
}
void arith()
{ int ch;
cout<<"Arithmetic operators\n";
delay(1200);
cout<<"It provides operations for five basic arithmetic
calculations:addition,subtraction,multiplication,division and remainder
respectively.\n";
cout<<"There are different types of operators\n";
delay(1200);
cout<<"1.Unary Operators\n2.Binary operators\n3.Ternary operators \n4.logical
operators\n5.Type conversion\n6.exit\n";
cout<<"enter your choice\n";
cin>>ch;
switch(ch)
{case 1:cout<<"unary Operators\n";
cout<<"It act upon one operands\n";
cout<<"Example implementing all unary operators\n";
int n,i=1,sum=0;
cout<<"enter the value of n:";
cin>>n;
cout<<"n first"<<n<<"natural numbers are :nn";
do
{
cout<<i;
sum=sum+i;
i++;
}
while(i<=n);
cout<<"nn sum="<<sum;
break;
break;
case 4:cout<<"Logical operators \n";
cout<<"These are ||(logical Or),&&(Logical AND) and! (logical NOT)\n";
cout<<"Example implementing logical operators\n";
int rem;
cout<<"enter the number";
cin>>n;
while(n!=0)
{
rem=n%10;
sum+=rem;
n/=10;
}
cout<<"the sum of the digits of the number is "<<sum;
break;
case 5:char chi;
cout<<"Type conversion\n";
cout<<"It is a process of converting one predefined type into another\n";
cout<<"There are two types of conversion \n";
cout<<"a.Implicit type conversion\nb.Explicit type conversion\n";
cin>>chi ;
switch(chi)
{case 'a':cout<<"Implicit type conversion\n";
cout<<"It is a conversion performed by the compiler without programmer's
intervention.\n";
break;
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<process.h>
#include<dos.h>
void inte()
{cout<<"Example of int data type ........\n";
int dividend,divisor,rem,hcf;
cout<<"enter two numbers:";
cin>>dividend>>divisor;
while(rem!=0)
{rem=dividend%divisor;
if(rem==0)
hcf=divisor;
else
{dividend=divisor;
divisor=rem;
}}
cout<<"hcf is:"<<hcf;
}
void chara()
{cout<<"Example of char data types are........\n";
char ch;
cout<<"Enter character between a to j\n";
cin>>ch;
int num=ch;
cout<<char(num+1);
cout<<" "<<char(num+2);
cout<<" "<<char(num+3);
cout<<" "<<char(num+4);
void flo()
{cout<<"example of float data types....\n";
int r;
cin>>r;
cout<<"radius of circle="<<r;
float z=(r*r)*22/7;
{int f1;
cout<<"Function:\n"<<"It is the method or concept for implementing modularity
in C++ programming\n";
cout<<"There are two types of function:\n1.User defined \n2.Predefined\n";
cin>>f1;
switch(f1)
{case 1:cout<<"User defined:Function defined by the user for specific
purpose\n";
cout<<"Declaration:\neg:-void function()";
break;
case 2:cout<<"Pre-defined function.\n eg:-cout,cin"; }
}
void point()
{cout<<"pointer:\n"<<"It is a variable that stores the address of the another
variable as its content";
cout<<"Example implementing pointers\n";
cout<<"Void main()\n{clrscr();\nint
*ptr,a=10;\nptr=$a;\ncout<<ptr;\ncout<<*ptr";
}
void refer()
{cout<<"Reference:\n"<<"It is to give an alternate name to the same memory
location.i.e,same memory accesed using two different variable names";
cout<<"Example implementing reference......\n";
cout<<"#include<iostream.h>\n#include<conio.h>\nvoid X(int &A,int
&B)\n{A=A+B;\nB=A-B;\nA=A-B;}\nvoid main()\n{clrscr();\nint
a=4,b=18;\nX(a,b);\ncout<<a<<","<<b;\ngetch();\n}\n";
}
void cla()
{cout<<"A class represents a group of similar objects.\n";
cout<<"Example of class...........\n";
char T,man,deb;
char choice;
cout<<"Chapter 7:Data Handling.\n";
delay(1880);
cout<<"There are three types of data types:\n1.Fundamental data
types\n2.Derived data type\n3.User defined data types\n";
cin>>ch;
switch(ch)
{case 1:cout<<"Fundamental data types \n";
cout<<"Fundamental data types are those that are not compose of
other data types\n";
cout<<"They are of different types ..........\n";
cout<<"a.int data types\nb.char data types.\nc.float data
type\nd.double data types.\ne.void data type\n";
cin>>man;
if(man=='a')
{inte();
}
else
if(man=='b')
{chara();
}
else
if(man=='c')
{
flo(); }
else
if(man=='d')
{doubl();}
break;
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
void main()
{
textmode(C80);
textcolor(GREEN);
textbackground(BLUE);
clrscr();
char ch;
cout<<"\t\t\nW\a-e\a-l\a-c\a-o\a-m\a-e t\a-o\a- c\a-h\a-a\a-p\a-t\a-e\a-r\a66\n"<<""<<"\t\tGetting started with c++\t\t"<<""<<"\n";
gotoxy(9,5);
label:
clrscr();
cout<<"1.Keyword\n"<<"2.Literals\n"<<"3.Identifires\n"<<"4.punctutors\n"<<"
5.Operators\n6.Exit\n";
cout<<"enter your choice\n";
cin>>ch;
switch(ch)
{ char q,e;
case '1':cout<<"Keyword\n";
cout<<"keyword is tokens in which Reserved word having special
meaning and purpose.These reservedfor special purpose and must not be used
as normal identifire names. \n";
cout<<"The example of Keywords are:-\n";
cout<<"asm\tcontinue\tfloat\tnew\tsigned\ttry\t\nauto\tdefault\tfor\toperator\tsiz
eof\ttypedef\t\nbreak\tdelete\tfriend\tprivate\tstatic\tunion\t\ncase\tdo\tgoto\tpro
tected\tstruct\t\n";
cout<<"\n\n To exit to main menu\n\t Press e\n";
cin>>q;
if( q=='e')
{
goto label;
}
break;
case '2':cout<<"Literals\n";
cout<<"Literals are constant that are assigned value and the fixed
literals do not change their value during the program expression\n";
cout<<"Literals are of various types \n";
cout<<"a.bool literals\n"<<"b.interger constants\n"<<"c.character
constants\n"<<"d.string literals\n";
cout<<"enter your choice\n";
cin>>ch;
switch(ch)
default:cout<<"wrong choice!!!!!!!";}
break;
case '3':cout<<"Identifiers\n";
cout<<"It is the fundamental building blocks of program and are
used as the general terminology for the names given to different parts of the
program viz.variables,objects,classes,functions,arrays etc.\n";
cout<<"C++ is a case sensitive as it treats upper and lower case
character differently.\n";
cout<<"The identifire which are valid.......................\n";
delay(1100);
cout<<"\nMyfile\tDate9_77\tZ2t0i9\nMYFILE\t_DS\t_HIJK_14\nCHK\tFILE13\n";
cout<<"The identifire which are not valid..................\n";
delay(1200);
break;
case '5':cout<<"operators\n";
cout<<"operators are categorise\n";
cout<<"1.urnary operators\n"<<"2.binary operators\n"<<"2.Ternary
operators";
cout<<"The example of binary operators are........\n";
cout<<"#include<iostream.h>\n#include<conio.h>\nvoid
manish(int x,int y)\n{int s;\ns=x+y;\ncout<<''the sum is\t''<<s<<''\n'';\nint
sub;\nsub=x-y;\ncout<<''the substract is\t''<<sub<<''\n'';\nint
mul;\nmul=x*y;\ncout<<''the multiply is\t''<<mul<<\n;\nfloat
div;\ndiv=x/y;\ncout<<''the division is\t''<<div;\n}\nvoid
main()\n{\nclrscr();\nint x,y;\ncout<<''enter the value of x and
y\n'';\ncin>>x>>y;\nmanish(x,y);\ngetch();\n}";
break;
case '6':exit(0);
#include<iostream.h>
#include<conio.h>
#include<process.h>
struct rail{ int pseat;
char pname[20];
float pfare;
char pbirth;
char pcomp;
}r1[3];
void rail()
{for(int i=0;i<3;i++)
{cout<<"\tThe passenger number\t"<<i+1;
cout<<"\n\tEnter the passenger name\t";
cin>>r1[i].pname;
cout<<"\n\tEnter the passenger compartment\n";
cin>>r1[i].pcomp;
cout<<"\n\tEnter the passenger seat\n";
cin>>r1[i].pseat;
cout<<"\n\tEnter the passenger fare\n";
cin>>r1[i].pfare;
cout<<"\n\tEnter the passenger birth\n";
cin>>r1[i].pbirth; }
}
void display()
{for(int i=0;i<3;i++)
{if(r1[i].pfare>1000)
cout<<"\n\tThe passenger seat is :\tReserved\n";
cout<<"\n\tThe passenger name is:"<<r1[i].pname<<endl;
cout<<"\n\tThe passenger fare is:"<<r1[i].pfare;
cout<<"\n\tThe passenger compartment is:"<<r1[i].pcomp;
cout<<"\n\tThe passenger birth is:"<<r1[i].pbirth;
cout<<endl;
}
}
void main()
{clrscr();
rail();
display();
getch();
}
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<process.h>
struct components{int ch;
char choice;
}c1;
void cls()
{cout<<"Class:\nIt is group of similar object";
cout<<"Example implementing class\n";
cout<<"\nclass_student-\n{private :\nint adm;\nchar name[x];\nchar sec;\nint
class;\npublic:\nvoid my function();};";
}
void stru()
{cout<<"Structure:\nIt is a heterogenous collection of fundamental and derived
types refer by a common name'struct'.";
cout<<"\nExample implementing structure";
cout<<"\nstruct student\n{int adm no;\nchar name[n];\nint cl;\nfloat avg;\nch
sec\n}";
}
void arr()
{cout<<"Array:\nIt is a collection of similar & dissimilar values of some data
types.";
cout<<"Example implimenting array......................\n";
cout<<"void main()\n{clrscr();\nint arr[5];\n cout<<'enter the
val';\ncin>>arr[0]>>arr[1]>>arr[2]>>arr[3]>>arr[4];\ncout<<arr[0]<<arr[1]<
<arr[2]<<arr[3]<<arr[4];\n}";}
void func()
{int f1;
cout<<"Function:\n"<<"It is the method or concept for implementing modularity
in C++ programming\n";
cout<<"There are two types of function:\n1.User defined \n2.Predefined\n";
cin>>f1;
switch(f1)
{case 1:cout<<"User defined:Function defined by the user for specific
purpose\n";
cout<<"Declaration:\neg:-void function()";
break;
case 2:cout<<"Pre-defined function.\n eg:-cout,cin"; }
}
void point()
{cout<<"pointer:\n"<<"It is a variable that stores the address of the another
variable as its content";
void main()
{clrscr();
cout<<"Chapter 7:Data Handling.\n";
clrscr();
cout<<"There are two types of data types:\n1.Derived data type\n2.User defined
data types\n";
cin>>c1.ch;
switch(c1.ch)
{case 1:cout<<"\t\tThere are different types of derived data types.\n";
cout<<"a.Array.\nb.Functions.\nc.Pointers\nd.Reference\ne.Constants\n";
cin>>c1.choice;
if(c1.choice=='a')
arr();
if(c1.choice=='b')
func();
if(c1.choice=='c')
point();
if(c1.choice=='d')
refer();
if(c1.choice=='e')
cons();
break;
case 2:cout<<"There are two types of user defined data types.\n";
cout<<"a.Class.\n b.Structure\n";
cin>>c1.choice;
if(c1.choice=='a')
cls();
if(c1.choice=='b')
stru();
}
getch();
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include<string.h>
struct Stru{char a4[6];
char first[18];
char second[15];
char email[25];
char pswrd1[19];
}h;
void function();
void function()
{
}
void main()
{int i;
char pswrd[]="computer";
char a1[]="Sign up";
char a2[]="Login";
textbackground(BLUE);
clrscr();
textcolor(WHITE);
char a3[]="Welcome to Facebook.\n";
for(int b3=0;b3<=strlen(a3);b3++)
{cout<<a3[b3];
delay(50);
}
gotoxy(5,4);
cprintf("Login\nSign up");
textcolor(WHITE);
cout<<"\nEnter your choice\n";
gets(h.a4);
if(strcmp(h.a4,a1)==0)
{textbackground(BLUE);
clrscr();
textcolor(WHITE);
gotoxy(7,7);
cout<<"Sign up\n It's free and always will be.\n";
cprintf("First Name_______________\n");
gotoxy(16,9);
cin>>h.first;
cprintf("Surname______________\n");
gotoxy(13,10);
cin>>h.second;
cprintf("Email______________________________\n");
gotoxy(8,11);
cin>>h.email;
cprintf("Re-enter email_______________________________\n");
gotoxy(18,12);
cin>>h.email;
cprintf("New password______________________\n");
gotoxy(15,13);
cin>>h.pswrd1;
cout<<"\n \t";
cprintf("Birthday");
cout<<"\tDate____________\tMonth_____________\tYear_____\n";
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<stdlib.h>
#include<dos.h>
#include<iomanip.h>
void main()
{clrscr();
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout<<setprecision(2);
textbackground(BLACK);
textcolor(CYAN+BLINK);
clrscr();
delay(1500);
puts("LOADING");
delay(2000);
for(int i=0;i<50;i++)
{
textcolor(CYAN);
textbackground(BLACK);
clrscr();
puts("LOADING");
for(int j=0;j<i;j++)
cout<<"_w_e_l_c_o_m_e...";
for(int x=10-(i);x>0;x--)
cout<<" ";
cout<<" "<<i<<"0%";
if(i%2==0)
delay(500);
else
delay(200);
}
puts("COMPLETE");
delay(500);
getch();
}
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<ctype.h>
#include<stdio.h>
#include<process.h>
#include<iomanip.h>
#include<math.h>
#include<fstream.h>
struct addr
{int hno;
char area[20];
char city[20];
char state[20];
};
class agent
{int code_a;
addr agt_add;
int pol_sold;
float sal_a;
char cat_a[10];
public:
void nw_agt();
void ex_agt();
int ret_agt_cod()
{return code_a;
}
void show_det()
{
cout<<"your code\n";
cout<<code_a;
cout<<"your name\n";
puts(name_a);
cout<<"your age\n";
cout<<age_a;
cout<<"your area\n";
cout<<agt_add.area;
cout<<"your city\n";
cout<<agt_add.city;
cout<<"your state\n";
cout<<agt_add.state;
cout<<"no of policy sold\n";
cout<<pol_sold;
cout<<"your salary\n";
cout<<sal_a;
cout<<"category of the agent\n";
puts(cat_a);
}
}a;
void agent::nw_agt()
{int ch;
cout<<"please enter your details\n";
cout<<"enter your code\n";
cin>>code_a;
cout<<"enter your name\n";
gets(name_a);
cout<<"enter your age\n";
cin>>age_a;
cout<<"enter your area\n";
cin>>agt_add.area;
cout<<"enter your city\n";
cin>>agt_add.city;
cout<<"enter your state\n";
cin>>agt_add.state;
cout<<"no of policy sold\n";
cin>>pol_sold;
cout<<"enter your salary\n";
cin>>sal_a;
cout<<"category of the agent\n";
gets(cat_a);
cout<<"\n\ndo you want to save these details of the customer\n";
cin>>ch;
if(ch=='y')
{fstream f("agent_details.dat",ios::in|ios::out|ios::binary);
while(!f.eof())
{f.write((char*)&a,sizeof(agent));
}
f.close();
}
else
exit(0);
}
void agent::ex_agt()
{int sea,fg=0;
cout<<"please enter your agent code\n";
cin>>sea;
fstream f("agent_details.dat",ios::in|ios::out|ios::binary);
while(!f.eof())
{f.read((char*)&a,sizeof(agent));
if(a.ret_agt_cod()==sea)
{
cout<<"match found\n";
a.show_det();
fg=1;
break;
}
else
{if(fg==0)
cout<<"not found\n";
}
}
f.close();
}
class customer
{char name_c[20]; //name of the customer
int age_c;
addr cust_add;
int code_c;
float pol_amt;
int pol_term;
//premium
public:
void nw_cust();
void show_det_cust()
{
cout<<"name\n";
cout<<name_c;
cout<<"age\n";
cout<<age_c;
cout<<"house no\n";
cout<<cust_add.hno;
cout<<"area\n";
cout<<cust_add.area;
cout<<"your city\n";
cout<<cust_add.city;
cout<<"your state\n";
cout<<cust_add.state;
cout<<"name of policies bought\n";
cout<<pol_bout;
cout<<"salary of the customer\n";
cout<<sal_c;
cout<<"code of the customer\n";
cout<<code_c;
cout<<"amount of the policy\n";
cout<<pol_amt;
cout<<"duration of the policy\n";
cout<<pol_term;
cout<<"the mode of payment\n";
cout<<mode_pay;
cout<<"salary per annum\n";
cout<<sa_pr_annum;
cout<<"premium\n";
cout<<premium;
}
int ret_cust_cod()
{return code_c;
}
}c;
struct feedback
{int age_f;
char name_f;
char ratings[5];
//ratings given
}fd;
void wpage();
void customer::nw_cust()
{ int ch2;
cout<<"Please enter your details\n";
cout<<"enter name\n";
cin>>name_c;
cout<<"enter your age\n";
cin>>age_c;
cout<<"enter your house no\n";
cin>>cust_add.hno;
cout<<"enter area\n";
cin>>cust_add.area;
cout<<"enter your city\n";
cin>>cust_add.city;
cout<<"enter your state\n";
cin>>cust_add.state;
cout<<"enter name of policies bought\n";
cin>>pol_bout;
cout<<"enter salary of the customer\n";
cin>>sal_c;
cin>>ch3;
if(ch3==1)
{cout<<"\t\tEndowment Policy\n";
cout<<"1.Age :8 yrs(minimum)to 55 yrs(maximum)\n2.term:12 yrs to 35
yrs\n3.amount:1 lakh to no limit\n4.age proof:standard\n5.accidental
benifits:no\n";
}
else
if(ch3==2)
{clrscr();
cout<<"\t\tMoney back Policy\n";
cout<<"1.age:5 yrs to 50 yrs\n2.term:20 yrs\n3.premium paying term:15
yrs\n4.SA:5 lakhs\n5.mode:yearly/monthly\n\nNOTE:\n->Sum assured in multiple
of 10,000\n";
}
else
if(ch3==3)
{clrscr();
cout<<"\t\tJEEVAN RAKSHAK\n";
cout<<"age:8 to 55 yrs.\n2.policy term:10 to 20 yrs\n3.minimum sum
assured:75,000\n4.maximum sum assured:2 lakhs\n5.accidental
benifits:yes@0.50%\n6.mode:yearly/monthly\n";
}
else
if(ch3==4)
{clrscr();
cout<<"\t\tJEEVAN ANAND\n";
cout<<"1.age:18 to 55 yrs\n2.policy terms:15 to 35 yrs\n3.SA:1 lakhs to no
limit\n4.mode:yearly/monthly\n\nNOTE:\n->sum assured in multiple of 5000\n";
}
else
if(ch3==5)
{clrscr();
cout<<"\t\tJEEVAN NIDHI\n";
cout<<"1.age:20 to 60 yrs\n2.policy terms:7 to 35 yrs\n3.SA:1 lakh to no
limimt\n4.service tax:3.09% and 1.545%5.mode:yearly/monthly\n6.accidental
benifits:RS.1/1000 sa\n7.policy loan:no\n";
}
}
else
if(ch1==6)
{clrscr();
cout<<"\n\n\n\n\t\t\t\tTHANK YOU !!!!\n";
getch();
exit(0);
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<stdio.h>
#include<stdlib.h>
struct addr
{int hno;
char area[20];
char city[20];
char state[20];
};
class agent
{int code_a;
addr agt_add;
int pol_sold;
float sal_a;
char cat_a[10];
public:
void nw_agt();
void ex_agt();
int ret_agt_cod()
{return code_a;
}
void show_det()
{
cout<<"your code\n";
cout<<code_a;
cout<<"your name\n";
puts(name_a);
cout<<"your age\n";
cout<<age_a;
cout<<"your area\n";
cout<<agt_add.area;
cout<<"your city\n";
cout<<agt_add.city;
cout<<"your state\n";
cout<<agt_add.state;
cout<<"no of policy sold\n";
cout<<pol_sold;
cout<<"your salary\n";
cout<<sal_a;
cout<<"category of the agent\n";
puts(cat_a);
}
}a;
void agent::nw_agt()
{int ch;
cout<<"please enter your details\n";
cout<<"enter your code\n";
cin>>code_a;
void agent::ex_agt()
{int sea,fg=0;
cout<<"please enter your agent code\n";
cin>>sea;
fstream f("agent_details.dat",ios::in|ios::out|ios::binary);
while(!f.eof())
{f.read((char*)&a,sizeof(agent));
if(a.ret_agt_cod()==sea)
{
cout<<"match found\n";
a.show_det();
fg=1;
break;
}
else
{if(fg==0)
cout<<"not found\n";
}
f.close();
}
}
void main()
{clrscr();
int ch;
cout<<"who are you!!!! Are you a \n1.new agent\n2.existing agent\n";
cin>>ch;
if(ch==1)
{a.nw_agt();
}
else
{a.ex_agt();
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<process.h>
#include<stdlib.h>
struct addr
{int hno;
char area[20];
char city[20];
char state[20];
};
class customer
{char name_c[20]; //name of the customer
int age_c;
addr cust_add;
int code_c;
float pol_amt;
int pol_term;
//premium
int ch;
public:
void nw_cust();
void ex_cust();
}c;
void customer::nw_cust()
{ cout<<"enter name\n";
cin>>name_c;
if(ch=='y')
{fstream f("customer_details.dat",ios::in|ios::out|ios::binary);
while(!f.eof())
{f.write((char*)&c,sizeof(customer));
}
f.close();
}
else
exit(0);
}
void customer::ex_cust()
{int sea,ch;
cout<<"please enter your customer code\n";
cin>>sea;
fstream f("customer_details.dat",ios::in|ios::out|ios::binary);
while(!f.eof())
{f.read((char*)&c,sizeof(customer));
if(code_c==sea)
cout<<"match found\n";
}
f.close();
}
void main()
{clrscr();
int ch;
cout<<"who are you!!!! Are you a \n1.new customer\n2.existing customer\n";
cin>>ch;
if(ch==1)
{c.nw_cust();
}
else
{c.ex_cust();
}
getch();
}