Laboratory Experiments:
1. Write a C++ program to find the sum for the given variables using function with default arguments.
2. Write a C++ program to swap the values of two variables and demonstrates a function using call by value.
3. Write a C++ program to swap the values of two variables and demonstrates a function using Call by reference using reference type (&).
4. Write a C++ program to swap the values of two variables and demonstrates a function using Call by reference using pointer (*).
5. Write a C++ program to swap the values of two dynamically allocated variables and release the memory after swapping. (use new & delete operators)
6. Write a program to find the largest, smallest & second largest of three numbers. (use inline function MAX and MIN to find largest & smallest of 2 numbers)
7. Write a program to calculate the volume of different geometric shapes like cube, cylinder and sphere and hence implement the concept of Function Overloading.
8. Write a C++ program to create a template function for Bubble Sort and demonstrate sorting of integers and doubles.
Laboratory Experiments:
1. Define a STUDENT class with USN, Name, and Marks in 3 tests of a subject. Declare an array of 10 STUDENT objects. Using appropriate functions, find the average of the two better marks for each student. Print the USN, Name and the average marks of all the students.
2. Write a C++ program to create a class called COMPLEX and implement the following overloading functions ADD that return a complex number:
(i) ADD (a, s2) – where ‘a’ is an integer (real part) and s2 is a complex number
(ii) ADD (s1, s2) – where s1 and s2 are complex numbers.
3. Friend functions and friend classes:
a) Write a program to define class name HUSBAND and WIFE that holds the income respectively. Calculate and display the total income of a family using Friend function.
b) Write a program to accept the student detail such as name and 3 different marks by get_data() method and display the name and average of marks using display() method. Define a friend class for calculating the average of marks using the method mark_avg().
4. Create a class called MATRIX using two-dimensional array of integers. Implement the following operations by overloading the operator == which checks the compatibility of two matrices to be added and subtracted. Perform the addition and subtraction by overloading the + and – operators respectively. Display the results by overloading the operator <<. If (m1== m2) then m3 = m1+m2 and m4 = m1- m2 else display error.
5. Write a program to create an HUMAN class with features as number of Head, Legs, Hands.(NOTE: Number of Head, Legs and Hands are of integer types)
a. Create an object HUMAN1 using default constructor. (Default features to have 1 Head, 2 Legs and 2 Hands)
b. Create an object HUMAN2 with customized inputs using Parameterized Constructor
c. Create an object HUMAN3 using existing object HUMAN1 (Copy Constructor).
d. All Humans die after their lifetime. (Destructor)
6. Demonstrate Simple Inheritance concept by creating a base class FATHER with data members SurName and BankBalance and creating a derived class SON, which inherits SurName and BankBalance feature from base class but provides its own feature FirstName and DOB. Create and initialize F1 and S1 objects with appropriate constructors and display the Father & Son details. (Hint : While creating S1 object, call Father base class parameterized constructor through derived class by sending values)
7. Create an abstract base class EMPLOYEE with data members: Name, EmpID and BasicSal and a pure virtual function Cal_Sal().Create two derived classes MANAGER (with data members: DA and HRA and SALESMAN (with data members: DA, HRA and TA). Write appropriate constructors and member functions to initialize the data, read and write the data and to calculate the net salary. The main() function should create array of base class pointers/references to invoke overridden functions and hence it implements run-time polymorphism.
8. Write a program to implement FILE I/O operations on characters. I/O operations includes inputting a string, Calculating length of the string, Storing the string in a file, fetching the stored characters from it, etc.
9. Write a program to implement Exception Handling with minimum 5 exceptions Classes including two built-in exceptions.
10. a.Write a program to concatenate 2 strings using STL String class functions.
b.Write a simple C++ program to store and display integer elements using STL Vector class.
Note 1: In the practical Examination each student has to pick one question from PART-A and PART-B each.
Note 2: Change of program is not permitted in the Practical Examination.