Unit 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 78

Please read this disclaimer before proceeding:

This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document
through email in error, please notify the system manager. This document
contains proprietary information and is intended only to the respective group /
learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender
immediately by e-mail if you have received this document by mistake and delete
this document from your system. If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in reliance on
the contents of this information is strictly prohibited.
22CS101: PROBLEM SOLVING
USING C++
Department : Science and Humanities

Batch / Year : 2022 – 2026 / I

Created by : Ms. G. Vasukidevi, AP/S&H


Dr. G. Sangeetha, AP/ADS
Ms. T. Karpagam, AP/ADS
Ms. R. Sandhiya, AP/CSE
Ms. P. Sreelekha , AP/CSE
Ms. G Mageshwari AP/ADS

Date :
1. Table of Contents
SLIDE
S.NO. CONTENTS
NO.

1 CONTENTS 5
2 COURSE OBJECTIVES 6
3 PRE REQUISITES (COURSE NAMES WITH CODE) 7
4 SYLLABUS (WITH SUBJECT CODE, NAME, LTPC DETAILS) 8

5 COURSE OUTCOMES
12

6 CO- PO/PSO MAPPING 13

7 LECTURE PLAN – UNIT 3 15


8 ACTIVITY BASED LEARNING – UNIT 3 17
9 LECTURE NOTES – UNIT 3 19
10 ASSIGNMENT III- UNIT 3 57

11 PART A Q & A (WITH K LEVEL AND CO) 59

12 PART B Q s (WITH K LEVEL AND CO) 66

13 SUPPORTIVE ONLINE CERTIFICATION COURSES 68

REAL TIME APPLICATIONS IN DAY TO DAY LIFE AND TO


14 70
INDUSTRY

15 ASSESSMENT SCHEDULE 73

16 PRESCRIBED TEXT BOOKS & REFERENCE BOOKS 75

17 MINI PROJECT SUGGESTIONS 77


2. Course Objectives
21CS101 PROBLEM SOLVING USING C++ LTPC
3024
OBJECTIVES
To learn problem solving and programming fundamentals.
To gain knowledge on pointers and functions.
To apply the principles of object oriented programming.
To understand operator overloading, inheritance and
polymorphism.
To use the functionalities of I/O operations, files build
C++ programs using exceptions.
3. Pre Requisites
NIL
4. Syllabus
22CS101 PROBLEM SOLVING USING C++ L T P C
SYLLABUS 3 0 0 3

OBJECTIVES:

 To learn problem solving and programming fundamentals.


 To gain knowledge on pointers and functions.
 To apply the principles of object oriented programming.
 To understand operator overloading, inheritance and polymorphism.
 To use the functionalities of I/O operations, files build C++ programs using
exceptions.

UNIT I PROBLEM SOLVING AND PROGRAMMING FUNDAMENTALS 15

Computational thinking for problem solving - Algorithmic thinking for problem


solving -Building Blocks - Problem Solving and Decomposition - Dealing with Error -
Evaluation.

Overview of C – Data types – Identifiers – Variables – Storage Class Specifiers –


Constants – Operators - Expressions – Statements – Arrays and Strings – Single-
Dimensional – Two- Dimensional Arrays – Arrays of Strings – Multidimensional
Arrays.

UNIT II POINTERS AND FUNCTIONS 15

Pointers -Variables – Operators – Expressions – Pointers and Arrays – Functions -


Scope Rules – Function Arguments – return Statement – Recursion – Structures –
Unions – Enumerations.
UNIT III CLASSES AND OBJECTS 15
Concepts of Object Oriented Programming – Benefits of OOP – Simple C++
program - Classes and Objects - Member functions -Nesting of member
functions - Private member functions - Memory Allocation for Objects - Static
Data Members - Static Member functions - Array of Objects - Objects as
function arguments - Returning objects - friend functions – Const Member
functions - Constructors – Destructors

UNIT IV OPERATOR OVERLOADING, INHERITANCE AND


POLYMORPHISM 15

Operator Overloading - Overloading Using Friend functions – Inheritance –


Types of inheritance – Virtual Base Class - Abstract Class – Constructors in
Derived Classes - member class: nesting of classes.
Pointer to objects – this pointer- Pointer to derived Class - Virtual functions –
Pure Virtual Functions – Polymorphism
UNIT V I/O, FILES AND EXCEPTIONS 15

C++ Streams – Unformatted I/O - Formatted Console I/O – Opening and


Closing File – File modes - File pointers and their manipulations – Templates –
Class Templates – Function Templates - Exception handling.

TOTAL 45+30 = 75 PERIODS

Indicative List of Experiments:

1. Write C/C++ programs for the following:


a. Find the sum of individual digits of a positive integer.
b. Compute the GCD of two numbers.
c. Find the roots of a number (Newton‘s method)

2. Write C/C++ programs using arrays:


a. Find the maximum of an array of numbers.
b. Remove duplicates from an array of numbers.
c. Print the numbers in an array after removing even numbers
3. Write C/C++ programs using strings:
a. Checking for palindrome.
b. Count the occurrences of each character in a given word.

4. Generate salary slip of employees using structures and pointers. Create a


structure Employee with the following members:
EID, Ename, Designation, DOB, DOJ, Basicpay
Note that DOB and DOJ should be implemented using structure within
structure.
5. Compute internal marks of students for five different subjects using
structures and functions.
6. Write a program Illustrating Class Declarations, Definition, and Accessing Class
Members.
7. Program to illustrate default constructor, parameterized constructor and copy
constructors

8. Write a Program to Demonstrate the i) Operator Overloading. ii) Function


Overloading.

9. Write a Program to Demonstrate Friend Function and Friend Class.

10. Program to demonstrate inline functions.

11. Program for Overriding of member functions.

12. Write C++ programs that illustrate how the following forms of inheritance are
supported:
a) Single inheritance b)Multiple inheritance c)Multi level inheritance
d)Hierarchical inheritance
13. Program to demonstrate pure virtual function implementation.
14. Count the number of account holders whose balance is less than the minimum
balance using sequential access file.
13. Write a Program to Demonstrate the Catching of all
Exceptions.

14. Mini project.

TEXT BOOKS:
1. Herbert Schildt, “The Complete Reference C++”, 4th edition,
MH, 2015. (Unit 1 & 2)
2. E Balagurusamy,”Object Oriented Programming with C++”, 4th
Edition, Tata McGraw- Hill Education, 2008. (Unit 3, 4 & 5)
REFERENCES:
1. Karl Beecher,”Computational Thinking: A beginner's guide to
problem-solving and programming”, BCS Learning &
Development Ltd, 2017. (Unit 1)
2. Nell Dale, Chip Weems, “Programming and Problem Solving
with C++”, 5th Edition, Jones and Barklett Publishers, 2010.
3. John Hubbard, “Schaum's Outline of Programming with C++”,
MH, 2016.
4. Yashavant P. Kanetkar, “Let us C++”, BPB Publications, 2020
5. ISRD Group, “Introduction to Object-oriented Programming
and C++”, Tata McGraw- Hill Publishing Company Ltd., 2007.
6. D. S. Malik, “C++ Programming: From Problem Analysis to
Program Design”, Third Edition, Thomson Course Technology,
2007
5. COURSE OUTCOME
At the end of this course, the students will be able to:

CO1: Solve problems using basic constructs in C.


CO2: Implement C programs using pointers and functions.
CO3: Apply object-oriented concepts and solve real world
problems.
CO4: Develop C++ programs using operator overloading and
polymorphism.
CO5: Implement C++ programs using Files and exceptions.
7. CO-PO/PSO MAPPING

POs and PSOs

PO10

PO11

PO12

PSO1

PSO2

PSO3
PO1

PO2

PO3

PO4

PO5

PO6

PO7

PO8

PO9
COs

CO1 3 3 3 3 3 2 1

CO2 3 3 3 3 3 3 3 1

CO3 3 3 3 3 3 3 3 3 3 3 3 3 1

CO4 3 3 3 3 3 3 3 1

CO5 3 3 3 3 3 3 3 1
Lecture Plan

UNIT III
Unit III

S. No. Propos Actual Taxono Mode


N Topic of ed Pertain
Lecture ing CO my of
o. Perio Date Date Level Deliver
ds y

1 Concept of OOPs and 1 Chalk &


Benefits of OOPs CO3 K1 Talk/PPT

2 Simple C++ 1 Chalk &


Programs CO3 K1 Talk/PPT

3 Classes and Objects 1 Chalk &


CO3 K1 Talk/PPT

Member functions
4 Nesting of member 1 Chalk &
functions, Private CO3 K1 Talk/PPT
member functions

Memory allocation for


objects, Static data Chalk &
5 members and 1 CO3 K1 Talk/PPT
Static member
functions

6 Arrays of objects 1 Chalk &


CO3 K1 Talk/PPT

Object as function Chalk &


7 arguments, Returning 1 CO3 K1 Talk/PPT
objects

Friend functions, Chalk &


8 Const member 1 CO3 K1 Talk/PPT
functions

9 Constructors, 1 Chalk &


Destructors CO3 K1 Talk/PPT
Activity Based Learning

UNIT III
Activity Based Learning

1. In programming, we try to depict our real world scenarios using


code.
Represent inheritance (like we inherit our features from
our parents) we use concepts of inheritance in different languages. A
car inherits all the features from a class vehicle or a manager is an
employee, so it is having all the properties of that object/class too,
all these relationships can be described by using inheritance in
different ways. The mind map shows its advantages, disadvantages,
types, implementations in C++.
2. A concept map showing some key elements in Object-oriented
Programming represent using mind map
Lecture Notes

UNIT III

Concepts of Object Oriented Programming – Benefits of OOP –


Simple C++ program - Classes and Objects - Member functions
- Nesting of member functions - Private member functions -
Memory Allocation for Objects - Static Data Members - Static
Member functions - Array of Objects - Objects as function
arguments - Returning objects - friend functions – Const
Member functions - Constructors – Destructors
3.1 CONCEPT OF OBJECT ORIENTED PROGRAMMING

The programming paradigm where everything is represented


as an object is known as object-oriented programming
language.
Object Oriented Programming is a paradigm that provides
many concept such as inheritance, data binding,
polymorphism etc.,
Object means a real world entity such as pen, chair, table
etc.,
Object Oriented Programming is a methodology or paradigm
to design a program using classes and objects.
It simplifies the software development and maintenance by
providing some concepts such as
1. Object
2. Class
3. Inheritance
4. Abstraction
5. Encapsulation
6. Polymorphism
7. Dynamic Binding
8. Message Passing
3.2 BENEFITS OF OOP
 OOP offers several benefit to both the program designer and
the user.

The advantages are:

1. Through inheritance, we can eliminate redundant code and


extend the use of existing classes.
2. It helps to build program from the standard working
module that communicate with one another, rather than
having to start writing the code from scratch. This leads to
saving of development time and higher productivity.
3. The principal of data hiding helps the programmer to build
secure programs that cannot be invaded by code in other
part of the program.
4. It is possible to have multiple instance of an object to co-
exist without any interference.
5. It is easy to partition the work in a project, based on
objects.
6. Object oriented systems can be easily upgraded from small
to large systems.
7. Message passing techniques for communication between
objects makes the interface description with external
systems much simpler.
8. Software complexity can be easily managed.
3.3 SIMPLE C++ PROGRAMS
//PRINT NUMBER ENTERED BY USER
#include<iostream>
using namespace std;
int main()
{
int number;
cout<<“Enter an integer: ”;
cin>> number;
cout<<“You entered: ” << number;
return 0;
}
OUTPUT
Enter an integer: 23
You entered: 23

//PROGRAM TO FIND QUOTIENT AND REMAINDER


#include<iostream>
using namespace std;
int main()
{
int divisor, dividend, quotient,remainder;
cout<< “Enter dividend: ”;
cin>> dividend;
cout<< “Enter divisor: ”;
cin>> divisor;
quotient = dividend / divisor;
remainder = dividend % divisor;
cout<< “Quotient= “ << quotient << endl;
cout<< “Remainder= “<<remainder;
return 0;
}
OUTPUT
Enter dividend: 13
Enter divisor: 4
Quotient = 3
Remainder = 1
//Program to check palindrome number
#include<iostream>
using namespace std;
int main()
{
int n, num, digit, rev=0;
cin>> num;
n=num;
while(n>0)
{
digit = num%10;
rev=(rev*10)+digit;
num = num/10;
}
if(n==rev)
cout<<“The number is a palindrome.”;
else
cout<<“The number is not a palindrome.”;
return 0;
}
Output
Enter the positive number: 12321
The reverse of the number is: 12321
The number is a palindrome
//PROGRAM TO CHECK PRIME NUMBER
#include<iostream>
using namespace std;
int main()
{
int num, i;
cin>>num;
for (i=2;i<=num-1;i++)
{
if (num%i==0)
{
cout<<"The number is not a prime number";
break;
}
}
if (i== num)
cout<<"The number is a prime number";
return 0;
}

Output
5
The number is a prime number

6
The number is not a prime number
//PROGRAM TO DISPLAY ALL FACTORS OF A NUMBER

#include<iostream>
using namespace std;
int main()
{
int n, i;
cin>>n;
for(i=1;i<=n;i++)
{
if(n%i==0)
{
cout<<i<<“ “;
}
}
return 0;
}
Output
60

1 2 3 4 5 6 10 12 15 20 30 60
//PROGRAM TO CHECK VOWEL OR A CONSONANT MANUALLY
#include<iostream>
using namespace std;
int main()
{
char c;
bool islower, isupper;
cin>>c;
islower=(c==‘a’ || c==‘e’ || c==‘I’ || c==‘o’ || c==‘u’);
isupper=(c==‘A’ || c==‘E’ || c==‘I’ || c==‘O’ ||c==‘U’);
if(!isalpha(c))
cout<<“Not a alphabet”;
else
if(islower || isupper)
cout<< c<<“is a vowel”;
else
cout<<c<<“is a consonant.”;
return 0;
}
Output
Enter an alphabet: u
u is a vowel
3.4 CLASS AND OBJECT
3.4.1 CLASS
• Classes are the blueprint for the objects.
• It is a user-defined datatype, which holds its own data members and
member functions, which can be accessed and used by creating an
instance of that class.
• The data and functions within a class are called members of the class.
• For example, Consider the Class of Cars. There may be many cars with
different names and brand but all of them will share some common
properties like 4 wheels, Speed limit, Mileage range etc.,
• So here, Car is the Class and wheels, speed limits, mileage are
their properties.
DEFINING A CLASS
• A Class is defined using keyword class followed by the name of the
class.
• The body of the class is defined inside the curly brackets and
terminated by the semicolon at the end.

EXAMPLE
class Car // The Class
{
Public: // Access specifier
string brand;
string model; //Attributes
int year;
};
3.4.2 Object
• An Object is an instance of a class.
• Objects are the basic run-time entities in an object-oriented system.
• They may represent a person, a place, a bank account, a table of
data or any item that the program has to handle.
• Objects take up space in the memory and have an associated
address like a record in Pascal or a structure in C.
• When a program is executed, the objects interact by sending
messages to one another.
• For example, if “customer” and “account” are two objects in a
program, then the customer object may send a message to the
account object requesting for the bank balance.

Declaring Object
• When Class is defined no memory is allocated but when it is
instantiated memory is allocated.
• The object is created to uses the data and access functions defined
in the class.
SYNTAX
ClassName ObjectName;
EXAMPLE
#include<iostream>
using namespace std;
class Car
{
Public:
string brand;
string model;
int year;
};
int main()
{
Car obj1; // Creating an object of class car
obj1.brand = “BMW”;
obj1.model = “X5”;
obj1.year = 1999;
cout << obj1.brand << ” “ << obj1.model << “ “ << obj1.year;
}
O/P
BMW X5 1999
3.5 Data Members and Member Functions
 Data members are the data variables and member functions
are the functions used to manipulate these variables and
together defines the properties and behavior of the objects
in the class.
For example,
Car is the class, the speed limit, mileage are the data
members and apply brakes, increase speed are the member
functions.
Example
#include<iostream>
using namespace std;
class Car
{
public:
int speed_limit, mileage; //Data member
void apply_break() // Member function
{
cout<< “Applybreak” ;
}
void increase_speed() // Member function
{
cout<< “Increase speed” ;
}
}
int main()
{
Car obj1; // Creating object for the class
Obj1.apply_break(); // Accessing member function
increase_speed(); // Accessing member function
}
Output
Apply break
Increase speed
3.5.1 Accessing Data Member and Member Functions
• The data members and member functions of class can be accessed using
dot (.) operator with the object.
• The public data members can be accessed directly by the object whereas
the private data member cannot be accessed directly by the object.

• Accessing data members depends on the access control of that data


members.

Example

#include<iostream>
using namespace std;
class Car
{
public:
string model //Data member
void printcarmodel() // Member function
{
cout<< “ Car model name is ” <<model;
}
}
int main()
{
Car obj1; // Creating object for the class
obj1.model = “BMW X5”; // Accessing data member
obj1.printcarmodel(); // Accessing member function
}
O/P
Car model name is BMW X5
3.5.2 Defining Member Functions in Classes
• Member functions can be defined in two places:
i) Outside the class definition
ii) Inside the class definition

i) Outside The Class Definition

• To define a function outside the class definition, it can be declared inside


the class and define outside of the class.
• It can be performed by specifiying the name of the class, followed the
scope resolution operator(::), followed by the name of the function.
Example
#include<iostream>
Using namespace std;
class Cars
{ O/P
public: I am BMW
void printname();
};
void Cars:: printname()
{
cout << “I am BMW”;
}
int main()
{
Cars obj1;
obj1.printname();
}
ii) Inside The Class Definition
• Another method of defining a member function is to replace the function
declaration by the actual function definition inside the class.
Example
#include<iostream>
using namespace std;
class Cars O/P
{ I am BMW
public:
void printname()
cout << “I am BMW”;
};
int main()
{
Cars obj1;
obj1.printname();
}
3.6 Nesting of Member Function
 A member function can be called by using its name inside another
member function of the same class. This is known as nesting of member
function.

EXAMPLE
#include<iostream>
using namespace std;
class set
{
int m, n;
public: Output
void input(void): Input values of m and n
void display(void); 23 13
int largest(void); Largest value = 23
};
int set :: largest(void)
{
if(m>=n)
return (m);
else
return(n);
}
void set :: input(void)
{
cout << “Input values of m and n” << “\n”;
cin >> m >> n;
}
void set :: display(void)
{
cout<< “Largest value =” << largest() << “\n”;
}
int main()
{
set A;
A.input();
A.display();
return 0;
}
3.7 Private Member Function

• A function declared inside the private access specifier of the class is


known as a private member function.
• A private member function can be accessed through the only public
member function of the same class.

Example

For example, there is a class named “student” which has the following
private data members and public member functions:

Private Data Members


• rNo is used to store the roll number of the student.
• perc is used to store the percentage of the student.

Public Member Functions

read() – read() function is used to read roll number and percentage of


the student.

print() – print() function is used to print roll number and percentage


of the student.

Here, TakeNumberBegin() and TakeNumberBeginFinish() are the private


member functions which are calling inside public member function in the
same class.
#include <iostream>
using namespace std;
class Student
{
private:
int rNo;
float percentage;
void TakeNumbersBegin(void) //private member functions
{
cout<<"Input start..."<<endl;
}
void TakeNumbersBeginFinish(void)
{
cout<<"Input end..."<<endl;
}
public:
void read(void) //public member functions
{
TakeNumbersBegin(); //calling first member function
cout<<“Enter roll number”;
cin>>rNo;
cout<<“Enter percentage”;
cin>>percentage;
TakeNumbersBeginFinish(); //calling second member function
}
void print(void)
{
cout<<endl;
cout<<"Roll Number: "<<rNo<<endl;
cout<<"Percentage: "<<percentage<<"%"<<endl;
}
};
int main() //main code
{
Student object1; //Declaring object of class student
object1.read(); // reading and printing details of a student
object1.print();
return 0;
}
Output
Input started…
Enter roll number: 5
Enter percentage: 10
Input end…
Roll Number: 5
Percentage: 10
3.8 Memory Allocation for Object

• Before using a member of a class, it is necessary to allocate the


required memory space to that member.
• The way the memory space for data members and member functions is
allocated is different regardless of the fact that both data members and
member functions belong to the same class.
• The memory space is allocated to the data members of a class only
when an object of the class is declared, and not when the data members
are declared inside the class.
• Since a single data member can have different values for different
objects at the same time, every object declared for the class has an
individual copy of all the data members.
• On the other hand, the memory space for the member functions is
allocated only once when the class is defined.
• In other words, there is only a single copy of each member function,
which is shared among all the objects.

• For instance, the three objects, namely, book1, book2 and book3 of
the class book have individual copies of the data members title and
price.

• However, there is only one copy of the member functions getdata ()


and putdata () that is shared by all the three objects.
3.9 Static Data Members
• Static data members are class members that are declared using the static
keyword.
• There is only one copy of the static data member in the class, even if
there are many class objects.
• This is because all the objects share the static data member.
• The static data member is always initialized to zero when the first class
object is created.

Syntax:

static data_type data_member_name;

• In the above syntax, static keyword is used. The data_type is the C++ data
type such as int, float etc.
• The data_member_name is the name provided to the data member.

Example:
#include <iostream>
#include<string.h>
using namespace std;
class Student
{
private:
int rollNo;
char name[10];
int marks;
public:
static int objectCount;
Student()
{
objectCount++;
}
void getdata()
{
cout << "Enter roll number: "<<endl;
cin >> rollNo;
cout << "Enter name: "<<endl;
cin >> name;
cout << "Enter marks: "<<endl;
cin >> marks;
}
void putdata()
{
cout<<"Roll Number = "<< rollNo <<endl;
cout<<"Name = "<< name <<endl;
cout<<"Marks = "<< marks <<endl;
cout<<endl;
}
};
OUTPUT:
int Student::objectCount = 0;
Enter roll number: 1
int main(void)
Enter name: Mark
{
Enter marks: 78
Student s1;
Roll Number = 1
s1.getdata();
Name = Mark
s1.putdata();
Marks = 78
Student s2;
s2.getdata();
Enter roll number: 2
s2.putdata();
Enter name: Nancy
Student s3;
Enter marks: 55
s3.getdata();
Roll Number = 2
s3.putdata();
Name = Nancy
cout << "Total objects created = “
Marks = 55
<< Student::objectCount;
return 0; Enter roll number: 3
} Enter name: Susan
Enter marks: 90
Roll Number = 3
Name = Susan
Marks = 90
Total objects created = 3
3.10 Static Member Function
• The static member functions are special functions used to access the
static data members or other static member functions.
• A member function is defined using the static keyword.
• A static member function shares the single copy of the member
function to any number of the class objects.
• We can access the static member function using the class name or
class objects.
• If the static member function accesses any non-static data member or
non-static member function, it throws an error.

SYNTAX:
class_name::function_name(parameter);

EXAMPLE:
//create program to access the static member function using
the class name
#include <iostream>
using namespace std;
class Note
{
static int num; //Declare a static data member
public:
static int fun() // Create static member function
{
return num;
}
};
/*Initialize the static data member using the class name and the scope
resolution operator*/
int Note :: num =5; int main()
{
/*Access static member function using the class name and scope
resolution operator*/
cout<<“The value of the num is: “<<Note :: fun() <<endl;
return 0;
}
Output:
The value of the num is: 5
3.11 Arrays of Objects
• We know that an array can be of any data type including struct.
• Similarly, we can also have arrays of variables that are of the type class.
• Such variables are called arrays of objects.
Consider the following class definition:
class employee
{
char name[30];
float age;
public:
void getdata(void);
void putdata(void);
};
The identifier employee is a user-defined data type and can be used to
create objects that relate to different categories of the employees.
Example:
employee manager[3]; //array of manager
employee foreman[15]; //array of foreman
employee worker[75]; //array of worker

• The array manager contains three objects (manager[0],


manager[1],manager[2]) of type employee class. Similarly, the foreman
array contains 15 objects and the worker array contains 75 objects.
• Since an array of objects behaves like any other array, we can use the
usual array-accessing methods to access individual elements, and then
the dot member operator to access the member functions.
Example:
manager[1].putdata();
• The above statement will display the data of the ith element of the array
manager. That is, this statement requests the object manager[i] to
invoke the member function putdata().
• An array of objects is stored inside the memory in the same way as a
multi-dimensional array.
• Member functions are stored separately and will be used by all the
objects.
Example:
#include<iostream>
using namespace std;
class employee Output:
{ Details of manager1
char name[30]; Enter name: Geetha
float age;
public: Enter age: 45
void getdata(void); Details of manager2
void putdata(void); Enter name: Arun
}; Enter age: 37
void employee :: getdata(void) Details of manager3
{
cout<< “Enter name: ”; Enter name: Sam
cin>> name; Enter age: 50
cout<< “Enter age: ”; Manager1
cin>>age; Name: Geetha
} Age: 45
void employee :: putdata(void)
{ Manager2
cout<< “Name: ”<< name << “\n”; Name: Arun
cout<< “Age: ”<< age << “\n”; Age: 37
} Manager3
const int size = 3; Name: Sam
int main()
{ Age: 50
employee manager[size];
for(int i=0; i<size; i++)
{
cout << “\nDetails of manager” << i+1 << “\n”;
manager[i].getdata();
}
for(int i=0; i<size; i++)
{
cout<< “\nManager” << i+1 << “\n”;
manager[i].putdata();
}
return 0;
}
3.12 Object as Function Argument
• The objects of a class can be passed as arguments to member functions
as well as non member functions either by value or by reference.
• When an object is passed by value, a copy of the actual object is created
inside the function.
• This copy is destroyed when the function terminates.
• Moreover, any changes made to the copy of the object inside the function
are not reflected in the actual object.
• On the other hand, in pass by reference, only a reference to that object
(not the entire object) is passed to the function.
• Thus, the changes made to the object within the function are also
reflected in the actual object.
• Whenever an object of a class is passed to a member function of the
same class, its data members can be accessed inside the function using
the object name and the dot operator.
• However, the data members of the calling object can be directly accessed
inside the function without using the object name and the dot operator.
Example:
#include<iostream>
using namespace std; Output:
class student Average marks = 82
{
public:
double marks;
student(double m)
{marks=m;}
};
void calculateAverage(student s1, student s2)
{
double average = (s1.marks+s2.marks)/2;
}
int main()
{
student student1(88.0),student2(76.0);
calculateAverage(student1,student2);
return 0;
}
3.13. Returning Object
• An object is an instance of a class. Memory is only allocated when an
object is created and not when a class is defined.
• An object can be returned by a function using the return keyword.
Example
#include<iostream>
using namespace std;
class student
{
public: Output:
double marks1,marks2; Marks1= 96.5
}; Marks2= 75
student createstudent()
{
student s;
s.marks1=96.5;
s.marks2=75.0;
cout<<“Marks1= “<<s.marks1<<endl;
cout<<“Marks2= “<<s.marks2<<endl;
return s;
}
int main()
{
student student1;
student1=createstudent();
return 0;
}
3.14 FRIEND FUNCTIONS
• A friend function of a class is defined outside that class scope but it has
the right to access all private and protected members of the class.
• Even though the prototypes for friend functions appear in the class
definition, friends are not member functions.
• A friend can be a function, function template, or member function, or a
class or class template, in which case the entire class and all of its
members are friends.
• To declare a function as a friend of a class, precede the function
prototype in the class definition with keyword friend.
Example:
class Box
{
double width;
public:
double length;
friend void printWidth(Box box);
void setWidth(double wid);
};
• To declare all member functions of class ClassTwo as friends of class
ClassOne, place a following declaration in the definition of class ClassOne.
Example: friend class Class Two;
Example:
#include<iostream>
using namespace std;
class Box
{ Output
double width:
Width of box: 10
public:
friend void printWidth(Box box);
void setWidth(double wid);
};
void Box :: setWidth(double wid) //Member function definition
{
width = wid;
}
void printWidth(Box box) //printwidth() is a friend of Box
{
cout<<”Width of box: “<<box.width<<endl;
}
int main()
{
Box box;
box.setWidth(10.0);
printWidth(box);
return 0;
}
3.15 Const Member Function
• The const member functions are the functions which are declared as
constant in the program. The object called by these functions cannot be
modified.
• It is recommended to use const keyword so that accidental changes to
object are avoided.
• A const member function can be called by any type of object.
• Non-const functions can be called by non-const objects only.
Syntax:
i) For function decleration within a class
<return type> <function name> () const
ii)For function definition within the class decleration
<return type> <function name> () const
{
//Body of the function
}

iii)For function definition outside the class


<return type> <class name> :: <function name>() const
{
//Body of the function
}
Example:
#include<iostream>
using namespace std;
class Demo
{ Output
int val; The value using object d: 28
public:
Demo(int x =0)
The value using object d1: 8
{
val = x;
}
int getvalue() const
{
return val;
}
};
int main()
{
const Demo d(28);
Demo d1(8);
cout<< “The value using object d: ” << d.getvalue();
cout<< “The value using object d1: ”<< d1.getvalue();
return 0;
}
3.16 CONSTRUCTOR
• It is a special method that is invoked automatically at the time of object
creation.
• It is used to initialize the data members of new objects.
• The constructor has the same name as the class or structure.
• Constructor is invoked at the time of object creation.
• Constructor does not have a return value, hence they do not have a return
type.
Syntax for constructor
<classname> (list of parameters);
• Constructor can be defined inside or outside the class declaration.

Syntax for defining the constructor within the class


<classname> (list of parameters)
{
//constructor definition
}
Example
#include<iostream>
using namespace std; Output:
class student
Enter the RollNo: 101
{
int rno; Enter the Name: Guru
char name[10]; Enter the Fee: 190000
double fee; 101 Guru 190000
public:
student()
{
cout << “Enter the RollNo: ”;
cin>>rno;
cout << “Enter the Name: “;
cin>>name;
cout << “Enter the fee: ”;
cin>>fee;
}
void display()
{
cout << endl << rno << “\t” << name << “\t” <<fee;
}
};
int main()
{
student s;
s.display();
return 0;
}
Syntax for defining the constructor outside the class
<classname> :: <classname> (list of parameter)
{
//constructor definition
}
Example
#include<iostream>
using namespace std;
class student Output:
{
Enter the RollNo: 102
int rno;
char name[10]; Enter the Name: Ram
double fee; Enter the Fee: 70000
public:
102 Ram 70000
student();
void display();
};
student :: student()
{
cout << “Enter the RollNo: ”;
cin>>rno;
cout << “Enter the Name: “;
cin>>name;
cout << “Enter the fee: ”;
cin>>fee;
}
void student::display()
{
cout<< endl << rno << “\t” <<name << “\t” << fee;
}
int main()
{
student s;
s.display();
return 0;
}
Characteristics of constructor
• The name of the constructor is the same as its class name.
• Constructor are mostly declared in the public section of the class though
it can be declared in the private section of the class
• Constructor do not return values. Hence they do not have a return type.
• A constructor gets called automatically when we create the object of the
class.
• Constructor can be overloaded.
• Constructor cannot be declared virtual.

3.16.1 TYPES OF CONSTRUCTOR


1.Default Constructor
2.Parameterized Constructor
3.Copy Constructor
3.16.1.1 Default Constructor
• Default constructor do not take any parameters. If a default constructor
is not provided by the programmer explicitly, then the compiler provides
a implicit default constructor.
• The default values of the variables are 0.
• If we do not define any constructor explicitly, the compiler will
automatically provide a default constructor implicitly.

Example
#include<iostream>
using namespace std;
class construct
{
public:
int a, b;
construct()
{
a=10;
b=20;
}
};
int main()
{
construct c;
cout<< “a: ”<< c.a<<endl<<“b: ”<<c.b;
return 1;
}

Output:
a: 10
b: 20
3.16.1.2 Parameterized Constructor
• The parameterized constructors can take arguments to initialize an object
when it is created.
• Parameters are added to a parameterized constructor just like they are
added to a normal function.
• When object is declared in a parameterized constructor, the initial values
have to be passed as arguments to the constructor function.
• The parameterized constructors can be called implicitly or explicitly.

USE OF PARAMETERIZED CONSRTUCTOR


• It is used to initialize the various data element of different objects with
different values when they are created.
• It is used to overload constructors.
Example:
#include<iostream>
using namespace std;
class Employee
{
public: Output
int id;
101 Sonu 89000
string name;
102 Naren 59000
float salary;
Employee(int i, string n, float s)
{
id = i;
name = n;
salary = s;
}
void display()
{
cout<<id<< “ ”<< name<< “ ”<<salary<<endl;
}
};
int main(void)
{
Employee e1 = Employee(101, “Sonu”, 89000);
Employee e2 = Employee(102, “Naren”, 59000);
e1.display();
e2.display();
return 0;
}
3.16.1.3 COPY CONSTRUCTOR
• A copy constructor is a member function that initializes an object using
another object of the same class.
• A constructor which creates an object by initializing it with an object of
the same class, which has been created previously is known as a copy
constructor.
SYNTAX
ClassName(const ClassName &old_obj);
Example:
#include<iostream>
#include<string>
using namespace std;
class student
{
int rno;
string name;
double fee;
public:
student(int,string,double);
student(student &t)
{ Output
rno = t.rno; 1001 Sam 10000
name = t.name; 1001 Sam 10000
fee = t.fee;
}
void display();
};
student ::student(int no,string n, double f)
{
rno = no;
name = n;
fee = f;
}
void student :: display()
{
cout<<endl<<rno<< “\t”<<name<< “\t”<<fee;
}
int main()
{
student s(1001, “sam”, 10000);
s.display();
student sam(s);
sam.display();
return 0;
}
3.17 Destructor
• A destructor is a special member function of a class that is executed
whenever an object of its class goes out of scope or whenever the delete
expression is applied to a pointer to the object of that class.
• A destructor will have exact same name as the class prefixed with a
tilde(~) and it can neither return a value nor can it take any parameters.
• Destructor can be very useful for releasing resources before coming out of
the program like closing files, releasing memories.
Example
#include<iostream>
using namespace std;
class Line
{
public:
void setLength(double len);
double getLength(void);
Line(); //This is the constructor decleration
~Line(); // This is the destrutor decleration
private:
double length;
};
Line :: Line(void)
{
cout<<“Object is being created”<<endl;
}
Line :: ~Line(void)
{
cout<<“Object is being deleted”<<endl;
}
void Line :: setLength(double len)
{
length = len; Output
} Object is being created
double Line :: getLength(void)
{ Length of line: 6
return length; Object is being deleted
}
int main()
{
Line line;
line.setLength(6.0);
cout<<“Length of Line: “<<line.getLength()<<endl;
return 0;
}
QUIZ
1. When is the object created with a new keyword?
a) At run time
b) At compile time
c) Depends on the code
d) None
Ans: (a)
2. Identify the scope resolution operator.
a) :
b) ::
c) ?:
d) None
Ans: (b)
3. Choose the option below which is not a member of the
class.
a) Friend function
b) Static function
c) Virtual function
d) Const function
Ans: (a)
4. Data members and member functions of a class are private.
default. True or False?
a) True
b) False
c) Depends on code
d) None
Ans: (a)
5.What is an object in c++?
a) It is a function of class
b) It is an instance of the class
c) It is the data type of class
d) It is part of the syntax of class.
Ans: (b)
6. By default, fields in a structure of a C program is?
a) public
b) Private
c) protected
d) None
Ans: (a)
7. To access data members of a class, which of the following
is used?
a) Dot operator
b) Arrow operator
c) Dot or arrow operator, as required
d) Dot, arrow, or direct call
Ans: (c)
8. Choose the option below which is used to free the memory
allocated for an object in C++.
a) Free()
b) unallocate()
c) delete
d) collect
Ans: (c)
9. In which of the following is memory allocated for the
objects?
a) RAM
b) ROM
c) Cache
d) HDD
Ans: (a)
10. Dynamic memory allocation can be done using?
a) calloc()
b) malloc()
c) Both (a) and (b)
d) create()
Ans: (c)
11. Another name of the generic class is?
a) Template class
b) Final class
c) Abstract class
d) Efficient code
Ans: (a)
12. Choose whether True or False: Object cannot be passed as
a function.
a) True
b) False
c) Depends on implementation
d) None
Ans: (a)
13. Identify the pure object-oriented programming language
among the following.
a) C++
b) SmallTalk
c) Java
d) Python
Ans: (b)
14. Identify the abstract data type among the following.
a) double
b) int
c) class
d) string
Ans: (c)
15. What is cout?
a) Operator
b) Object
c) Function
d) Macro
Ans: (b)
16. Which of the following is not an OOPS concept?
a) Encapsulation
b) Polymorphism
c) Exception
d) Abstraction Ans: (c)
17. A single program of OOPS contains _______ classes?
a) Only 1
b) Only 999
c) Only 100
d) Any number Ans: (d)
18. ____ is considered to be a partitioned area of computer
memory that stores and set of operations that can access the
data.
A. Classes
B. Objects
C. Variables
D. Functions
Ans: (b)
19. Which among the following is correct definition for static
member functions?
a) Functions created to allocate constant values to each object
b) Functions made to maintain single copy of member functions
for all objects
c) Functions created to define the static members
d) Functions made to manipulate static programs
Ans: (b)
20. The static member functions __________________
a) Have access to all the members of a class
b) Have access to only constant members of a class
c) Have access to only the static members of a class
d) Have direct access to all other class members also
Ans: (c)
21. The static member functions ____________________
a) Can be called using class name
b) Can be called using program name
c) Can be called directly
d) Can’t be called outside the function
Ans: (a)
22. The static member functions _______________
a) Can’t be declared const
b) Can’t be declared volatile
c) Can’t be declared const or volatile
d) Can’t be declared const, volatile or const volatile
Ans: (d)
23. Which keyword should be used to declare the static
member functions?
a) static
b) stat
c) const
d) common
Ans: (a)
24. The keyword static is used _______________
a) With declaration inside class and with definition outside the
class
b) With declaration inside class and not with definition outside
the class
c) With declaration and definition wherever done
d) With each call to the member function
Ans: (b)
25. If static data member are made inline, ______________
a) Those should be initialized outside the class
b) Those can’t be initialized with the class
c) Those can be initialized within the class
d) Those can’t be used by class members
Ans: (c)
ASSIGNMENT

UNIT III
Assignment Questions

S.No. Questions K-Level COs

Write a program which accepts days as


1 integer and display total number of years, K2 CO3
months and days in it.
Write a program in C++ to find the
2 K2 CO3
perfect numbers between 1 and 500
Write a program in C++ to calculate the
3 series (1) + (1+2) + (1+2+3) + K2 CO3
(1+2+3+4) + ... + (1+2+3+4+...+n).
Write a C++ program to find the most
4 K2 CO3
occurring element in an array of integers
Write a program which takes purchase
price and selling price of a product as
user input. It should then check if you got
profit or loss and then it should display
5 K3 CO3
the amount of profit or loss
9. Write a program which takes angles of
a triangle as input and check if the is
valid

Write a program which takes angles of a


6 triangle as input and check if the triangle k2 CO3
is valid or not.
Part A
Questions and Answer
Part A
1. List out the benefits of Object Oriented Programming?
• Can create new programs faster because we can reuse code
• Easier to create new data types
• Easier memory management
• Programs should be less bug-prone, as it uses a stricter syntax and type
checking.
• Data hiding

2. What are objects? How are they created?


• Objects are basic run-time entities in an object-oriented programming
system. The class variables are known as objects.
• Objects are created by using the syntax:
Classname obj1,obj2,……,objn; (or) during definition of the class:
Class classname
{
---------------
---------------
}obj1,obj2,…..,objn;

3. List out the basic concepts of Object oriented Programming?


• Objects.
• Classes.
• Data abstraction and Encapsulation.
• Inheritance.
• Polymorphism.
• Dynamic binding.
• Message passing

4. What are member functions?


• Functions that are declared within the class definition are referred as
member function.
• It operates on any object of the class of which it is a member, and has
access to all the members of a class for that object.
• Member functions can be defined within the class definition or separately
using scope resolution operator.
5.What is a Constructer?
• It is a special member function of a class which is invoked automatically at
the time of object creation. It is used to construct the memory of object &
provides initialization. Its name is same as class name.
Syntax:
<class-name> (list-of-parameters) { // constructor definition }

6. What is a friend function?


• If a function is defined as a friend function then, the private and
protected data of class can be accessed from that function.
• The complier knows a given function is a friend function by its keyword
friend.
• The declaration of friend function should be made inside the body of
class (can be anywhere inside class either in private or public section)
starting with keyword friend.

7. Write the properties of static member functions?


• A static member function can be called even if no objects of the class exist
and the static functions are accessed using only the class name and the
scope resolution operator ::.
• A static member function can only access static data member, other static
member functions and any other functions from outside the class.

8. What is a destructor?
• A Destructor is a special class function which destroys the object as soon as
the scope of object ends. The destructor is called automatically by the
compiler when the object goes out of scope.
• The syntax for destructor is same as that for the constructor, the class
name is used for the name of destructor, with a tilde ~ sign as prefix to it.

9. List different types of constructors?


• Copy constructor
• Parameterized constructor
• Default constructor
10. State the difference between class and structure?

Class Structure

Members of a class are private by Members of a structure are public


default by default

Member classes/structure of a class Member classes/structures of a


are private by default structure are public by default

It is declared using the class It is declared using the struct


keyword keyword

It is normally used for data It is normally used for the grouping


abstraction and further inheritance of data

11. What is new operator and delete operator?


• The new operator requests for the memory allocation in heap. If the
sufficient memory is available, it initializes the memory to the pointer
variable and returns its address.
pointer_variable = new datatype;
• The delete operator is used to deallocate the memory delete
pointer_variable;

12. Name three types of access modifiers in c++?


Three access modifiers in c++ are
• Public
• Private
• Protected

13. What is array of objects? Write the syntax for declaring array of
objects.
A. The Array of Objects stores objects. We can have arrays of variables that
are of the type class.
Syntax is
ClassName ObjectName[number of objects];
14. What are const member functions?
The const member functions are the functions which are declared as
constant in the program. The object called by these functions cannot be
modified. A const member function can be called by any type of object.

15. List the types of constructors?


• Default constructor
• Parameterized constructor
• Copy constructor.

16. What is a copy constructor?


A copy constructor is a member function that initializes an object
using another object of the same class.
Syntax is:
ClassName(const ClassName &amp;old_obj);

17. Which is the last function that is going to be called before an


object is destroyed?
• Destructor is an instance member function which is invoked automatically
whenever an object is going to be destroyed
• Destructor has the same name as their class name preceded by a tilde (~)
symbol.

18. How are objects passed as arguments to a function?


The function arguments can be objects and passed in two ways namely
pass by value and pass by reference.
In pass by value, a copy of the object as actual argument is passed to
the function and formal arguments of function receive the copy of the actual
argument and process it.
In pass by reference, the address of an object is passed as actual
argument and formal argument holds the address of objects of actual
arguments.

19. What do you mean by nesting of member function?


A member function can be called by using its name inside another
member function of the same class directly without using dot operator.
20. What do you mean by returning an object from function?
• A function can also return objects either by value or by reference.
• When an object is returned by value from a function, a temporary object is
created within the function, which holds the return value. This value is
further assigned to another object in the calling function.
• In the case of returning an object by reference, no new object is created,
rather a reference to the original object in the called function is returned to
the calling function.
21. Write the difference between constructor and destructor

Constructor Destructor

The constructor’s name must be the The destructor has the same as that of
same as that of the class the class prefixed by the tilde
symbol(~)
It is possible to overload the It is not possible to overload the
constructor function destructor function
A constructor can have a list of A destructor can’t have a list of
parameter parameter
It is not possible to inherit a It is not possible to inherit a destructor
constructor. But the constructor of the
base class can be considered a derived
class
When the object is created, the When the control reaches the end of
destructor is automatically executed the class scope, the destructor is
executed automatically to destroy the
object
Memory space reserved for the It destroys the object.
objects,

22. Write the characteristics of static data members.


• Only one copy of that member is created for the entire class and is shared
by all the objects of that class, no matter how many objects are created.
• It is initialized before any object of this class is being created, even before
main starts.
• It is visible only within the class, but its lifetime is the entire program
23. What are static member functions?

• A static member function can be called even if no objects of the class exist
and the static functions are accessed using only the class name and the
scope resolution operator ::
• A static member function can only access static data member, other static
member functions and any other functions from outside the class.

24. Write a c++ program to add two numbers.


#include<iostream>
using namespace std;
int main()
{
int x,y,sum;
cin>>x>>y;
sum=x+y;
cout<<sum;e
return 0;
}

25. Write a c++ program to generate multiplication table


#include<iostream>
using namespace std;
int main()
{
int n;
cout<<enter a positive integer: &quot;;
}
Part B
QUESTIONS
Part B

1. Explain the concept of class and object with suitable examples.


2. What are the basic concepts of object oriented programming?
Explain.
3. How will you define the member functions in classes? Explain.
4. Write the properties of static data members and explain static
member functions with an example c++ program.
5. Write c++ program to calculate the employee gross pay
(basic+hra+da) using array of objects.
6. Explain the concept of friend function with an example
program.
7. How will you initialize the data members of the class using
another object of the same class? Write a c++ program to
illustrate this.
8. What are the ways in which you can pass an object as
argument to a function? Explain.
9. Write a C++ program to find the square and cube of a given
number using the concept “nesting of member function”.
10.What are the different types of constructors? Explain.
Supportive Online
Certification
Certification Courses

COURSE NAME PLATFORM


C++ from beginner to expert Udemy
Introduction to programming in C++ edx

Programming in C++.A hands on Introduction Course era

Introduction to C++ Great Learning


Real time Applications

UNIT III
Real time Applications
1. Operating Systems
C++ is a fast and strongly-typed programming language
which makes it an ideal choice for developing operating
systems. Mac OS X has large amounts written in C++. Most of
the software from Microsoft like Windows, Microsoft Office, IDE
Visual Studio, and Internet Explorer are also written in C++.
2. Games
Since C++ is closer to hardware, game development
companies use it as their primary choice to develop gaming
systems. It can easily manipulate resources and can override
the complexities of 3D games and multiplayer networking.
3. GUI Based Applications
C++ is also used to develop GUI-based and desktop
applications. Most of the applications from Adobe such as
Photoshop, Illustrator, etc. are developed using C++.
4. Web Browsers
Web browsers need to be fast in execution as people do not
like to wait for their web pages to be loaded. This is why most
browsers are developed in C++ for rendering purposes. Mozilla
Firefox is completely developed from C++. Google applications
like Chrome and Google File System are partly written in C++
5. Embedded Systems
Various embedded systems that require the program to be
closer to hardware such as smartwatches, medical equipment
systems, etc., are developed in C++. It can provide a lot of low-
level function calls, unlike other high-level programming
languages.
6. Banking Applications
Since banking applications require concurrency, multi-
threading, concurrency, and high performance, C++ is the
default choice of programming language. Infosys Finacle is a
popular banking application developed using C++.
7. Compilers
The compilers of many programming languages are
developed in C and C++. This is because they are relatively
lower-level when compared to other higher-level languages and
are closer to the hardware.
8. Database Management Software
C++ is also used to write database management software.
The world’s most popular open-source database, MySQL, is
written in C++.
9. Cloud/Distributed Systems
Cloud storage systems that are used extensively need to
work closer to the hardware. This makes C++ the default
choice for implementing cloud storage systems. These systems
also require multithreading support to build concurrent
applications that support load tolerance, which C++ provides.
Bloomberg is a distributed RDBMS application that is primarily
written in C, but its development environment and set of
libraries are all written with C++.
10. Libraries
Libraries require very high-level mathematical computations,
performance, and speed. Hence C++ is the core programming
language used by most libraries. Tensorflow, one of the most
popularly used Machine Learning libraries uses C++ as
its backend programming language.
Assessment Schedule

UNIT III
Assessment Schedule

As Per Academic Schedule


Prescribed Text book &
References

UNIT III
Text books & References

TEXT BOOKS:
1. Herbert Schildt, “The Complete Reference C++”, 4th
edition, MH, 2015. (Unit 1 & 2)
2. E Balagurusamy,”Object Oriented Programming with C++”,
4th Edition, Tata McGraw- Hill Education, 2008. (Unit 3, 4 & 5)
REFERENCES:
1. Karl Beecher,”Computational Thinking: A beginner's guide
to problem-solving and programming”, BCS Learning &
Development Ltd, 2017. (Unit 1)
2. Nell Dale, Chip Weems, “Programming and Problem Solving
with C++”, 5th Edition, Jones and Barklett Publishers, 2010.
3. John Hubbard, “Schaum's Outline of Programming with
C++”, MH, 2016.
4. Yashavant P. Kanetkar, “Let us C++”, BPB Publications,
2020
5. ISRD Group, “Introduction to Object-oriented Programming
and C++”, Tata McGraw- Hill Publishing Company Ltd., 2007.
6. D. S. Malik, “C++ Programming: From Problem Analysis to
Program Design”, Third Edition, Thomson Course Technology,
2007
Mini Project Suggestions

UNIT III
Mini Project Suggestions

1. Super market Billing

Description: This C++ menu driven programs on


SUPERMARKET BILLING SYSTEM has product class with
data members like product no, product name, price, qty,
tax, discount. Product details is stored in a binary file. A
customer can purchase product and his invoice generated.
Administrator can create, modify, view and delete product
record.

2. Student report card Management

Description: This C++ mini project on STUDENT REPORT


CARD has student class with data members like roll no,
name, marks and grade. Member functions in this class are
used for accept / display details of students and a function
to calculate grade based on marks obtained by student.
Student Records are stored in binary file.

3. Library Management System

Description: This C++ menu driven programs on LIBRARY


MANAGEMENT SYSTEM has book and student class with
data members like book no, bookname, authorname. Books
records is stored in a binary file. A student can issue book
and deposit it within 15 days. Student is allowed to issue
only one book. Student Records are stored in binary file.
Administrator can add, modify or delete record.
Thank you

Disclaimer:
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document through
email in error, please notify the system manager. This document contains proprietary
information and is intended only to the respective group / learning community as
intended. If you are not the addressee you should not disseminate, distribute or
copy through e-mail. Please notify the sender immediately by e-mail if you have
received this document by mistake and delete this document from your system. If
you are not the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this information is
strictly prohibited.

You might also like