<aside> 💡

Write a program in C++ to input two numbers and find the sum and average of those numbers.

</aside>

Passing and returning objects as argument.

🔹 Basic Level

  1. Write a C++ program to create a Student class.

    Define a method that takes another Student object as an argument and compares their marks.

  2. Create a Rectangle class with length and breadth as data members.

    Write a member function that accepts another Rectangle object and returns the rectangle with the greater area.

  3. Define a class Time with hours and minutes as private data members.

    Write a function to add two Time objects by passing one as an argument.


🔹 Intermediate Level

  1. Create a class Distance with feet and inches.

    Overload a function that takes another Distance object and adds the two distances. Show both pass-by-value and pass-by-reference usage.

  2. Make a Complex number class with real and imaginary parts.

    Write a function add(Complex c) and another version add(const Complex &c) and demonstrate the difference in memory behavior.

  3. Write a program to demonstrate the concept of deep copying.

    Create a class Person with a dynamically allocated char* name and show how object is passed to a copy constructor.


🔹 Advanced Level

  1. Create a class BankAccount with methods to transfer money from one object to another.

    Implement the transfer(BankAccount &receiver, float amount) method.

  2. Create a class Matrix and write a function that multiplies two matrices.

    Accept the second matrix as an object parameter and return the result.

  3. Implement a class Polynomial and write a function to add two polynomials by passing objects as arguments.

  4. Define a class Circle and write a friend function compareArea(Circle c1, Circle c2) that compares two circles’ areas.