Professional Documents
Culture Documents
Science
Investigatory
Project
P a g e 1 | 24
Submitted By:
Arwin A.S
XII D 13
P a g e 2 | 24
ST.THOMAS CENTRAL SCHOOL
ST.THOMAS NAGAR, THIRUVANANTHAPURAM – 695043
Examiners:
P a g e 3 | 24
Project Overview
1 Acknowledgement
2 Introduction to C++
3 About project
4 Source code
5 Screen shot
6 Bibliography
P a g e 4 | 24
I am extremely thankful to my computer teacher
Mrs. ANUPA.K.NARAYANAN for her much valued timely help and guidance
Last but not the least, I thank all faculty members and
ARWIN.A.S
P a g e 5 | 24
INTRODUCTION TO C++
Software engineering
Graphics
P a g e 6 | 24
Object orienting programming OOP: programming using objects is
known as OOP. Object is an identifiable entity with some
characteristics and behavior. Object that share common property and
relationship are grouped together to form a class. In OOP, primary
importance is given to data than procedure. The data and its
associated functions are grouped to single unit called classes,
thereby protecting it from outside access. Thus it provides data
security. Also in OOP, using concept of classes models real world
problems. OOP employs bottom of approach of programming OOP concept
includes: Data abstraction: Abstraction refers to the act of
representing essential features without including the background
detail or explanation.
P a g e 7 | 24
ABOUT PROJECT
‘Carid’ for car id, ‘Carname’ for type of the car and ‘Price’ one
day rent price. The record is kept in the file named Rent.DAT.
read data values of object, Print() for print the object and
life and the code is useful for the students. The code contains
P a g e 8 | 24
P a g e 9 | 24
ICONS.H
P a g e 11 | 24
RENT.CPP
#include<iostream.h>
#include<dos.h>
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<string.h>
#include<ctype.h>
#include<process.h>
#include<graphics.h>
#include<icons.h>
class RentAcar
{
int Carid;
char Carname[50];
float Price;
public:
void Read();
void Print();
int Re_Cid();
};
void RentAcar::Read()
{
cout<<"Enter car id..";
cin>>Carid;
cout<<"Enter car name..";
gets(Carname);
cout<<"Enter price..";
cin>>Price;
}
void RentAcar::Print()
{
cout<<"\tCar id :"<<Carid<<endl;
cout<<"\tCar name :"<<Carname<<endl;
cout<<"\tPrice :"<<Price<<endl;
}
int RentAcar::Re_Cid()
{
return (Carid);
P a g e 12 | 24
}
void Insert()
{
RentAcar OB;
fstream F1;
F1.open("Rent.dat",ios::binary|ios::out|ios::app);
OB.Read();
F1.write((char *)&OB,sizeof(OB));
F1.close();
cin.sync();
}
void Display()
{
RentAcar OB;
fstream F1;
F1.open("Rent.dat",ios::binary|ios::in);
while(F1)
{
F1.read((char *)&OB,sizeof(OB));
if(F1.eof()==1)
{
break;
}
OB.Print();
}
F1.close();
}
void Remove()
{
RentAcar OB;
int rno,flag=0;
ifstream F1;
ofstream F2;
F1.open("Rent.dat",ios::binary|ios::in);
F2.open("Temp.dat",ios::binary|ios::out);
cout<<"\nEnter the car no to be delete..";
cin>>rno;
while(F1)
{
F1.read((char *)&OB,sizeof(OB));
if(F1.eof()==1)
P a g e 13 | 24
break;
if(OB.Re_Cid()!=rno)
{
F2.write((char*)&OB,sizeof(OB));
}
else
{
flag=1;
}
}
if(flag==1)
{
Icons_Line();
cout<<"\n\t[ Record is Deleted ]\n";
Icons_Line();
}
else if(flag==0)
{
Icons_Line();
cout<<"\nThe record is not found\n";
Icons_Line();
}
F1.close();
F2.close();
remove("RENT.DAT");
rename("TEMP.DAT","RENT.DAT");
cin.sync();
}
void Search()
{
RentAcar OB;
int rno,flag=0;
fstream F1;
F1.open("Rent.dat",ios::binary|ios::in);
cout<<"\nEnter the car id to search..";
cin>>rno;
while(F1)
{
F1.read((char *)&OB,sizeof(OB));
if(F1.eof()==1)
break;
if(OB.Re_Cid()==rno)
{
Icons_Line();
P a g e 14 | 24
OB.Print();
cout<<endl;
Icons_Line();
flag=1;
}
}
if(flag==0)
{
Icons_Line();
cout<<"\t[ Record is not found ]\n";
Icons_Line();
}
F1.close();
cin.sync();
}
void Modify()
{
RentAcar OB;
int rno;
int flag=0;
cout<<"\nEnter the car id to modify..";
cin>>rno;
fstream F1;
F1.open("Rent.dat",ios::binary|ios::in|ios::out);
while(F1)
{
int pos=F1.tellg();
cout<<pos;
F1.read((char *)&OB,sizeof(OB));
if(F1.eof()==1)
break;
if(OB.Re_Cid()==rno)
{
cout<<"Current record is\n";
Icons_Line();
OB.Print();
Icons_Line();
cout<<"\nEnter new record\n";
OB.Read();
F1.seekg(pos);
F1.write((char *)&OB,sizeof(OB));
flag=1;
Icons_Line();
cout<<"\n\t[ Record is Modified ]\n";
P a g e 15 | 24
Icons_Line();
break;
}
}
if(flag==0)
{
Icons_Line();
cout<<"\t[ Record is not found ]\n";
Icons_Line();
}
F1.close();
cin.sync();
}
void main()
{
clrscr();
//Icons_Graph();
// i_SpalshScreen();
char ch;
while(1)
{
clrscr();
Icons_Menu();
cout<<"Enter your choice..";
cin.get(ch);
cin.sync();
if(ch=='1')
{
char am;
do
{
clrscr();
cout<<"\n\t\t\tADD A NEW RECORD\n";
Icons_Line(6,80,177);
Insert();
Icons_Line(6,80,177);
cout<<"Record is successfully Added.";
cout<<"\nWould you like to add more [Y/N]..";
am=cin.get();
}while(toupper(am)=='Y');
}
else if(ch=='2')
{
clrscr();
P a g e 16 | 24
cout<<"\n\t\t\tD I S P L A Y R E C O R D \n";
Icons_Line(6,80,177);
Display();
}
else if(ch=='3')
{
clrscr();
cout<<"\n\t\t\tD I S P L A Y R E C O R D \n";
Icons_Line(6,80,177);
Remove();
}
else if(ch=='4')
{
clrscr();
cout<<"\n\t\t\tS E A R C H R E C O R D \n";
Icons_Line(6,80,177);
Search();
}
else if(ch=='5')
{
clrscr();
cout<<"\n\t\t\tM O D I F Y R E C O R D \n";
Icons_Line(6,80,177);
Modify();
}
else if(ch=='6')
{
clrscr();
i_SpalshScreen();
}
else if(ch=='7')
{
clrscr();
gotoxy(33,12);
cout<<"T H A N K Y O U\n\n" ;
gotoxy(50,24);
Icons_Press();
getch();
exit(0);
}
else
{
Icons_Line();
cout<<"\t Invalid choice\n";
P a g e 17 | 24
Icons_Line();
}
gotoxy(50,24);
Icons_Press();
getch();
}
}
P a g e 18 | 24
P a g e 19 | 24
Splash Screen
T
Main Menu
T
P a g e 20 | 24
Insert Record
Display
P a g e 21 | 24
Edit Record
P a g e 22 | 24
Search Record
P a g e 23 | 24
BIBILIOGRAPHY
T
Sumita Arora
➢ Computer Science
G.S.Anilkumar
Shiju S.S
Hashira
• http://projects.icbse.com/cpp-203
• http://www.cs.rochester.edu/
• http://www.cplusplus.com/forum/beginner/150081/
• http://www.cppbeginner.com/cpp-projects/cpp-address-
book-project
• http://www.dreamincode.net/forums/topic/66881-simple-
address-book/
P a g e 24 | 24