QP - E - 1 - Func Overloading
QP - E - 1 - Func Overloading
Question 1: (20)
Write a C++ program to calculate the perimeter/circumference of different
geometrical shapes as mentioned.
Write a function calculate() which receives different types of parameters and as per
the parameter, use function overloading to attain the required task.
calculate(10,20) - perimeter of rectangle with given length and breadth
calculate(10) - perimeter of square with given length
calculate(1.5) - circumference of circle with given radius
calculate(4,7,3) - perimeter of cuboid with the given length breadth and height.
Do the entire same process for surface area of all the 5 shapes with the function
name as area() and different parameters.
area(10,20) - area of rectangle with given length and breadth
area(10) - area of square with given length
area(1.5) - area of circle with given radius
area(4,7,3) - surface area of cuboid with the given length breadth and height.
Question 2: (10)
Write a C++ program to store a user’s email address, name, enrolment number,
marks, grade in a file “student.txt”.
The grade should be calculated as per the marks as:
A 80 and above
B 65 – 79
C 55 – 64
D 40 – 54
F 0 – 39
Input all the values from the user, store them in the file and print them in a proper
format after retrieving from the file.