Content Comp Sci

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

CONCEPT USED

One of the major concept used in the project was FILES

The two types of files are :

 TEXT FILE
 BINARY FILE

Files are used to store data in a device. C++ file handling provides a mechanism to
store output of a program in a file and read from a file on the disk.

A file can be opened in different modes to perform read and write operations. I have
used ios::out mode at various places in our program.

I have used binary files in the program to input information of each restaurant which
includes the name of the restaurant, menu of the restaurant and its rating.
CONCEPT USED

Another important part of the program is CLASSES

It is a user defined data type, which holds its own data members and member
functions, which can be accessed and used by creating an instance of that class. Data
members are the data variables and members functions are the functions used to
manipulate these variables and together these data members and member functions
defines the properties and behaviour of the objects in a class.

An object is an instance of a class. When a class is defined, no memory is allocated


but when it is instantiated memory is allocated. The object of the class is ‘f’.
WAYS TO DEFINE A MEMBER FUNCTION

There are 2 ways to define a member function:

 Inside class definition:

We used two inside-class functions which were char* rtnname(); and char*
rtncui(); which returns the name of the restaurant and cuisine respectively.

 Outside class definition:

To define a member function outside the class definition we have to use the scope
resolution :: operation along with class name and function name.

Few of the functions used were:

Void food::showdata(), void sort (char bill[6][30],int k) and void search_cui(char


a[]).

A class consist of DATA MEMBERS and MEMBER FUNCTIONS


The data members in our program are:

Char name[20]; float rating;

Char newnm[20]; int co1;

Char location[20]; int co2;

Char cui[20]; int co3;

Char item1[20]; int co4;

Char item2[20]; int co5;

Char item3[20]; int cost;

Char item4[20];

Char item5[20];

These were declared as public members and hence can also be accessed from
outside the class with the help of functions.

The member function are:


Void bill()

Void showdata()

Void sort()

Void qty()

Char* rtnname()

Char* rtncui()

You might also like