Question: Consider the following C++ code representing a typical class specification: Write down the C++ main function to create three objects with names OB1,OB2 and OB3,
Consider the following C++ code representing a typical class specification: Write down the C++ main function to create three objects with names OB1,OB2 and OB3, belonging to the class CLS as specified above, and then perform the following tasks sequentially: (i) Initializes OB1 with the value of 7.5. (ii) Prompts the user to enter a value at the keyboard and assigns this value to OB2. (iii) Swaps the data of OB1 and OB2. (iv) Computes the sum of the data of OB1 and OB2, and stores the result in OB3. (v) Retrieves and displays the data of OB3 on the screen. 12 marks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
