C++ Programs
C++ Programs
Write a
constructor to initialize the TOP of the STACK. Write a member function PUSH() to
insert an element and member function POP() to delete an element check for overflow
b) Write a C++ Program to create a File and to display the contents of that file with line
numbers.
2. a) Write a C++ Program to create a class ARITHMETIC which consists of a FLOAT and an
INTEGER variable. Write member functions ADD (),SUB(), MUL(), DIV() to perform
b) Write a C++ Program to create a class SHAPE which consists of two VIRTUAL
of various figures. Derive three classes SQUARE, RECTANGLE, TRIANGE from class
Shape and Calculate Area and Perimeter of each class separately and display the result.
3. a) Write a C++ Program to read an integer number and find the sum of all the digits until it
reduces to a single digit using constructors, destructors and inline member functions.
b) Write a C++ Program to check whether the given string is a palindrome or not using
Pointers.
4. a) Write a C++ Program to create a class FLOAT that contains one float data member.
Overload all the four Arithmetic operators so that they operate on the object FLOAT.
b) Write a C++ Program using Function Overloading to read two Matrices of different Data
Types such as integers and floating point numbers. Find out the sum of the above two
5. Write a C++ Program to create a class STRING. Write a Member Function to initialize,
get and display stings. Overload the operators ++ and == to concatenate two Strings and
b) Write a C++ Program to create two classes each class consists of two private variables, a
integer and a float variable. Write member functions to get and display them. Write a
FRIEND Function common to both classes, which takes the object of above two classes
as arguments and the integer and float values of both objects separately and display the
result.
6. a) Write a C++ Program to create class, which consists of EMPLOYEE Detail like
E_Number, E_Name, Department, Basic, Salary, Grade. Write a member function to get
and display them. Derive a class PAY from the above class and write a member function