OOPS lab

back

Queue and student progrs run under linux, versions of tc will be available soon.

1 Write a C++ program to create a class called COMPLEX, and implement the following by overloading the function ADD which returns the COMPLEX number.
i. ADD(s1, s2) - where s1 is an integer (real part) and s2 is a complex numbers
ii. ADD(s1, s2)- where s1 and s2 are complex numbers.
Display the result by overloading <<             
2 Write a C++ program to create a class LIST (linked list) with insert front, and delete from front as member functions .Demonstrate all functions after creating a list object. 
3 Write a C++ program to create a template function for quick sort and demonstrate sorting of integers and double data types.  
4 Write a C++ program to create a class called as STACK using array of integers. Implement the following operators by overloading them with the operators  + & -.Also display the status and contents of the stack after each operation, by overloading the operator with <<
i. sl=sl+element;where sl is a object of the class stack and element is an integer to be pushed on top of the stack
ii.sl=sl--;where sl is a object of the class STACK, - - operator pops the element 
5 Write a C++ program to create a class called as DATE. Accept two valid dates in the form on of dd/mm/yyy.Implement the following by overloading the operators - and +Display the results by overloading the operator << after every operation.
i. no_of_days=d1-d2 - where d1 is a DATE object and no_of_days is an integer
ii.d1=d1+no_of_days  - where d1 is a DATE object and no_of_days is an integer. 
6 Write a C++ program to create a class called as MATRIX using two dimensional array of integers. Implement the following by overloading the operator = which checks the compatibility of two matrices to be added and subtracted. Perform the following by overloading the + and - operators. Display the result by overloading the operator <<
if (m1=m2)
{
m3=m1+m2;
m4=m1-m2;
elisplay error}
Where m1,m2,m3,m4 are  MATRIX objects. 
7 Write a C++ program to create a class OCTAL which has characteristics of an octal number. Implement the following by writing an appropriate constructor and an overload operator +.Display the octal object by overloading the operator <<.Also display the values of k and y.
I. octal h=x;- where x is an integer.
ii. int y=h + k; where h is an OCTAL object and k is an integer. 
8 Write a C++ program to create a template class QUEUE, with add and delete member functions at .Using it , implement a queue of integers and doubles. Demonstrate the implementation by displaying the status and contrent of the queue after operation.
9 Write a C++ program to create a class called DLIST ( Double  linked list) with member functions, insert at a specified function, and delete from a specified position. Demonstrate the implement by displaying the status and content of a list after every operation. 
10 Write a C++ program to create a class LIST ,(linked list),with add and subtract member functions to add and subtract two long integers of at least 12 digits. Demonstrate the implementation my displaying the status and content of the list after every operation. The number of digits to be held in each node can be decided by the student himself/herself.) 
11 Write a C++ program to create a base class called as STUDENT(Name,Reg ,age) and using inheritance, create classesUgstudent and Pgstudent having fields as semester, fees and stipend.Enter the data for at least five students. Find the average age, semester wise, for all Ug and Pg students separately. 
12 Write a C++ program to create a STRING and implement the following. Display the results by overloading the operator << after every operation.
i.STRING s1="VTU"
ii.STRING s2="BELGAUM"

iii.STRING s3=s1+s2;-Use copy constructor 

13 Write a  C++ program to create a class called BIN_TREE ( binary tree) with member functions in order, preorder and postorder.Create a BIN_TREE object. demonstrate traversals 
14 Write a C++ program to create a class called EXPRESSION. Accept and arithmetic operation( assumed to be in valid INFIX form) and assign to EXPRESSION object. Convert the expression in the object to POSTFIX form by writing appropriate member functions. Display the results.
15 Write a C++ program to create a class called POLYNOMIAL of type X^n yn+a n-1X^n-1 y^n-1+...+a1X^1 y^1+a 0.
Implement the addition and subtraction of two POLYNOMIAL objects and display the results by overloading the operators << 

 

Download all progs at one click  

Compiling :
     $ c++ <file-name>
     $ ./a.out