C++ Prac
C++ Prac
1. Two integers.
2. Three floating-point numbers.
3. Two strings (lexicographically greater string).
Overload the max function to handle these scenarios. Input various sets of values
to test each overloaded function.
2
Define two classes, Circle and Cylinder.
Demonstrate the use of the friend class to calculate the area of a circle and the
volume of a cylinder.
3 Write a program in C++ to Create a Book class to represent books in a library. The
class should have the following
attributes:
Title (string)
Author (string)
ISBN (string)
Price (double)
Create objects for 3 books, input their details, and display the ones within a
specified budget.
4 Create a base class Rectangle that contains properties and functions to calculate the
area perimeter of a Rectangle. Derive a class cuboid from Rectangle, which includes
additional functionality to calculate the surface area and volume of a Cuboid. write
main program in C++ to calculate surface area and volume of the cuboid.
5
Define a Rectangle class with the following attributes:
Length (double)
Breadth (double)
Create multiple objects to represent different rectangles and calculate their area and
perimeter.
6
Write a C++ program that calculates the area of different shapes using function
overloading. Implement the following overloaded functions:
Demonstrate the use of these functions by calculating the area of a circle (radius =
7), a rectangle (length = 5, breadth = 10), and a triangle (base = 6, height = 8).
7 Write a program in C++ to overload the * and / operator to Multiply and divide two
complex numbers.
8
Create a C++ program that calculates the volume of different geometric shapes
using function overloading:
Test the functions with a cube of side 4, a cylinder with radius 3 and height 5, and a
box with dimensions 2, 3, and 4.
Demonstrate the use of the friend class to calculate the area of a circle and the
volume of a cylinder.
10 Write a program in C++ to calculate the grade of a student using a function. The
function should take three integer parameters representing the marks in three
subjects and return the average. Use another function to determine the grade based
on the average:
11
Design two classes, BankAccount and InterestCalculator.
Demonstrate the use of the friend function to calculate the interest for multiple
accounts.