MITS CODE
Home
Videos
  • Python
  • C Programing
  • Data Structures
Laboratory
  • Python
  • C Programing
  • C++
  • Java
  • Data Structures
Practice
  • Python
  • C Programing
  • Java
Events
Contact Us
MITS CODE
Home
Videos
  • Python
  • C Programing
  • Data Structures
Laboratory
  • Python
  • C Programing
  • C++
  • Java
  • Data Structures
Practice
  • Python
  • C Programing
  • Java
Events
Contact Us
More
  • Home
  • Videos
    • Python
    • C Programing
    • Data Structures
  • Laboratory
    • Python
    • C Programing
    • C++
    • Java
    • Data Structures
  • Practice
    • Python
    • C Programing
    • Java
  • Events
  • Contact Us
  • Home
  • Videos
    • Python
    • C Programing
    • Data Structures
  • Laboratory
    • Python
    • C Programing
    • C++
    • Java
    • Data Structures
  • Practice
    • Python
    • C Programing
    • Java
  • Events
  • Contact Us

20CSE204 OBJECT ORIENTED PROGRAMMING USING C++ LABORATORY

 1.   a.Create a class named 'Student' with a string variable 'name' and an integer variable. 'roll_no'. Assign the value of roll_no as '2' and that of name as "John" by creating an  object of the class Student. 

Solve

 b. Write a class having two private variables and one member function which will return  the area of the rectangle. 

Solve

 c. Perform addition operation on complex data using class and object. The program should  ask for real and imaginary part of two complex numbers, and display the real and  imaginary parts of their sum. 

Solve

 2. a. Write a program that asks a name say hello. Use your own function, that receives a  string of characters (name) and prints on screen the hello message. (Doesn't returns  anything- void type) 

Solve

 b. Write a program that ask for two numbers, compare them and show the maximum.  Declare a function called max_two that compares the numbers and returns the  maximum. 

Solve

 c. Write a C++ program that uses functions.

 i) to swap two integers          ii) to swap characters          iii) to swap two reals 

Solve

 3. a.Create a class 'Student' with three data members which are name, age and address. The  constructor of the class assigns default values to name as "unknown", age as '0' and  address as "not available". It has two functions with the same name 'setInfo'. First  function has two parameters for name and age and assigns the same whereas the second  function takes has three parameters which are assigned to name, age and address  respectively. Print the name, age and address of 10 students. Hint - Use array of objects 

Solve

 b. Create a class named 'Rectangle' with two data members- length and breadth and a  function to calculate the area which is 'length*breadth'. The class has three constructors  which are : 

1 - having no parameter - values of both length and breadth are assigned zero. 

2 - having two numbers as parameters - the two numbers are assigned as length and  breadth respectively. 

3 - having one number as parameter - both length and breadth are assigned that number. Now, create objects of the 'Rectangle' class having none, one and two parameters and  print their areas. 

Solve

 4. a.Using function overloading write C++program to find the volume of cube, cylinder,  cone and sphere.  

 b. Write a C++ program illustrating an interactive program for swapping integer, real, and  character type variables without using function overloading. Write the same program by  using function overloading features and compare the same with its C counterpart.  

Solve

 5. a. Write a C++ program to perform different arithmetic operation such as addition,  subtraction, division, modulus and multiplication using inline function.

    b. Write a program to swap private data members of classes named class_1, class_2 using  friend function.  

Solve

 6. a. Using operator overloading write a C++ program for class STRING and overload the  operator + and == to concatenate two strings length.  

Solve

 7. a. Write a C++ program illustrating Constructor overloading (Both parameterized and  default). 

 b. Write a C++ program illustrating for overloading ++ operator to increment data. 

Solve

 8. a.Write a C++ program illustrating overloading of new and delete operator. 

     b.Write a C++ program illustrating Abstract classes. 

Solve

 9. Write a C++ program illustrating Inheritance (Multiple, Multilevel, Hybrid). 

Solve

 10. a. Create a class 'Degree' having a function 'getDegree' that prints "I got a degree". It has  two subclasses namely 'Undergraduate' and 'Postgraduate' each having a function with  the same name that prints "I am an Undergraduate" and "I am a Postgraduate"  respectively. Call the function by creating an object of each of the three classes. 

Solve

  b. A class has an integer data member 'i' and a function named 'printNum' to print the  value of 'i'. Its subclass also has an integer data member 'j' and a function named  'printNum' to print the value of 'j'. Make an object of the subclass and use it to assign a  value to 'i' and to 'j'. Now call the function 'printNum' by this object. 

Solve

 11. a. Design a virtual base class for the employee information system.

      b. Implement a program using pure virtual function for calculating area and volume for  the circle and cylinder 

Solve

 12. a. Write a C++ program using Copy constructor to copy data of an object to another  object 

Solve

 13.a. Write a C++ program illustrating access data members & member functions using  ‘THIS’ pointer. 

     b. Write a program to illustrate the use of pointers to objects which are related by  inheritance 

Solve

 14. a.Write a C++ program to read and print employee details using Files. 

      b. Write a C++ program to copy the contents of one text file to another file. 

Solve

 15.a. Write a C++ program that uses function template to determine the square of an  integer, a float and a double 

    b. Write a Template Based Program to Sort the Given List of Element 

Solve

 16. a. Write a Program Containing a Possible Exception. Use a Try Block to Throw it and a  Catch Block to Handle it Properly.

      b. Write a Program to Demonstrate the Catching of All Exceptions 

Solve

Copyright © 2023 MITS CODE - All Rights Reserved.

  • Events

Created by -Sine Nitish , M Sangeetha

This website uses cookies.

We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.

Accept