Sunteți pe pagina 1din 24

Computer

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

Certified Bonafide Project done in Computer Science

by ………………………….. Reg.No. ………………………..

AISSCE March ……….. during the academic year……………….

Examiners:

1. ………………… Master in Charge

2. ………………… Head of Institution

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

rendered to me for completing my work, without whom this project

would not have been completed.

I also thank my principal Mr.SEBASTIAN.T.JOSEPH for all

the encouragement and the proper guidance given to me.

Last but not the least, I thank all faculty members and

my friends for their unflinching support and encouragement

throughout the course of work.

ARWIN.A.S

P a g e 5 | 24
INTRODUCTION TO C++

The c++ programming languages is an extension of c that


was developed by BJARNE STROUSTRUP in the early 1980’s at bell
laboratories. C++ provides the number of features that spruce up
the c language but more important, it provides capabilities for
object oriented programming. Object oriented programs are easier to
understand, correct and modify. Many other object oriented language
have been developed, including most notably small talk. The best
features of c are:

C++ is hybrid language –it is possible to program in either of c


like style an object oriented style or both.

C++ program consists of pieces called classes and functions. You


can program each piece you may need to form a c++ program. The
advantage of creating your own functions and classes is that you
will know exactly how they work you will able to examine the c++
code.

C++ provides the collection of predefined classes. The classes of


c++ are data types, which can be initiated any number of times.
Classes can name one or more parent classes, providing inheritance
and multiple inheritances respectively. Classes inherit the data
members and member functions of the parent classes that are
specified to be inheritable. Therefore it is mainly used for

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.

Encapsulation: Wrapping up of data and functions that operate on


the data into a single unit called class is called
encapsulation.
Inheritance: Inheritance is the capability of one class of things
to inherit capabilities or properties from another class.
Polymorphism: It is the ability for a message or data to proceed in
more than one form.
Modularity: Modularity is the splitting of program into different
modules

P a g e 7 | 24
ABOUT PROJECT

“RENTaCAR MANAGEMENT” is a simple

computerized car management system. It contain one class named

RentAcar. This system handles attributes of the relations named

‘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.

Although it is a file, we can search the record through Carid.

The system also handles functions Read()for

read data values of object, Print() for print the object and

Re_Cid()for return current object’s Carid. The records are

manipulated through the following functions- Insert(),

Display(),Remove(),Search() and Modify().

I hope the system is very useful in day to day

life and the code is useful for the students. The code contains

number of functions. The code is divided into two module files

named- ICONS.H and RENT.CPP.

P a g e 8 | 24
P a g e 9 | 24
ICONS.H

void Icons_Line(int co=6,int n=40,char ch='Í')


{
textcolor(co);
for(int x=1;x<=n;x++)
cprintf("%c",ch);
cout<<endl;
textcolor(15);
}
void Icons_Press()
{
textcolor(2+128);
cprintf("Press any key to continue...");
textcolor(15);
}
void Icons_Menu()
{
cout<<"\n\n";
Icons_Line(6,80,177);
textcolor(14);
cout<<"\t\t";
cprintf(" M A I N M E N U ");
cout<<endl;
Icons_Line();
cout<<"\t[1] Insert record "<<endl;
cout<<"\t[2] Dispaly record"<<endl;
cout<<"\t[3] Delete a record "<<endl;
cout<<"\t[4] Search a record"<<endl;
cout<<"\t[5] Edit a record"<<endl;
cout<<"\t[6] About the project"<<endl;
cout<<"\t[7] Exit"<<endl<<endl;
Icons_Line(6,80,177);
}
void i_SpalshScreen()
{
P a g e 10 | 24
clrscr();
for(int x=50;x>=20;x--)
{
delay(160);
gotoxy(x,10);
cputs(" P R O J E C T R E N T a C A R M
A N A G E M E N T ");
gotoxy(x,12);
cputs(" D E V E L O P E D B Y
: ");
textcolor(YELLOW);
gotoxy(x,16);
cout<<(" ARWIN.A.S ");
gotoxy(x,18);
cout<<(" NITHIN J PAULSON ");
gotoxy(x,20);
cout<<(" ANATHAKRISHNAN J ");
}
gotoxy(x,23);
textcolor(RED+BLINK);
cprintf(" Press Any Key To Continue....");
textcolor(WHITE);
getch();
}

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
}

//File manupulation functions

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

➢ Computer Science with C++

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

S-ar putea să vă placă și