- Write a program to calculate the area of circle, rectangle and square using function overloading.
- Write a program to demonstrate the use of default arguments in function overloading.
- Write a program to demonstrate the use of returning a reference variable.
- Create a function power() to raise a number m to power n, the function takes a double value for m and int value for n,and returns the result correctly. Use the default value of 2 for n to make the function calculate squares when this argument is omitted. Write a main that gets the values of m and n from the user to test the function.
- Write a basic program which shows the use of scope resolution operator.
Classes and Objects
• Display function to display values of data members.
• Total function to add marks of all 5 subjects and Store it in the data members
named total.
- Write a C++ program to swap the value of privatedata members from 2 different classes.
- Writea program to illustrate the use of this pointer.
- Anelection is contested by five candidates. The candidates are numbered 1 to 5and the voting is done by marking the candidate number on the ballot paper.Write a programto read the ballots and count the votes cast for each candidate using an array variablecount. In case a number is read outside the range of 1 to 5, the ballot shouldbe considered as a ‘spoilt ballot’ and the program should also count the numberof spoilt ballots.
- Writea program to call member functions of class in the main function using pointerto object and pointer to member function.
- Define a class to represent a bank account includethe following member variables.
ii) Account number.
iii) Type of account
iv) Balance
The class also has following member functions.
i) A function to assign initial value.
ii) A function to deposit an amount.
iii) A function to withdraw the amount after checking balance.
iv) A function to display the account information.
Write a menu driven program for bank system