You are on page 1of 5

Batch : 2011-14 Course Code : MCA-154

Session: 2011-12

Program :


Semester : I/II

Course Title :Object Oriented Programming in C++ Lab LIST OF PRACTICALS

Units Topics Unit I Basic , cin,cout. Implementing oops concepts in C++ like Objects, Classes etc. 1. Write a Simple program using Function, Cin, Cout 2. WAP to add, multiply,divide two input nos. 3. WAP to find smallest no out of 2 inputs using cin and cout. 4.Write a program in C++ to read the values of a, b and c and display the value of x where x = a / b c Test your program for the following values: (a) a = 250, b= 85, c= 25 (b) a=300, b=70, c = 70 5. Write a program that generates the following table 1990 135 1991 7290 1992 11300 1993 16200 use a single cout statement for all output. 6. Write me.cpp -- a program that take input about you and produces output describing yourself, such as: Name: John Whorfin Gender: Male DOB: 22 Jan 1997 Phone: 555-9876 Hobbies: Swimming, volleyball and eighthdimensional physics Quote: "Laugh while you can, monkey-boy!" 7. WAP To create class ACCOUNT. 8. Write a program in C++ to print first 10 multiples of an integer N, where N is to be entered by the user. 9. Develop a program for processing admission report. Use class concept for representing information such as roll number, name, date of birth (nested class), branch allotted. The format of report is as follows: Roll No. Name Date of Birth Branch Allotted Xx xxxxxxdd//mm//yyxxxxxxxxxxxxxx 10.A cricket team has the following table of batting figures for a series of test matches: Players Name

Runs Inning Times not out Sachin 8430 230 18 Sourav 4200 130 9 Rahul 3350 105 11 Write a program to read the figures set out in the above form, to calculate the battling averages and to print out the complete table including the averages. 11.Write a program that produces the following output: like flies an Time arrow ... Fruit like banana. flies a 12.WAP in C++ to convert string to upper or lower case. 13.Create a class employee which have name, age and address of the employee. Include functions getdata() and showdata(). Showdata takes the input from the user and display on the monitor Name: Age: Address: 14..WAP having function with reference. Unit II Constructors-Default copy Constructor Destructors Inline Functions 15.Write programs to implement following: (a)Inline Functions (b)Destructors (c)Copy Constructor to copy one string to another 16. Define a class city which has name and pincode. Define another class address which has house no. and city of type city. Define constructor and the destructor and print() which prints the address. Create an object of type address in main() and print it. 17. WAP to use static data member to keep track of count of object created and destroyed. Assignment operator 18. WAP of Deep copy 19. WAP of shallow copy

Access Modifiers Scope Resolution operator friend function 20. WAP using private /protected /public functions 21.WAP of friend function. 22..Write a program to assign data to the data members of a class such as day, month, year and to display the contents of the class on the screen. Further modify your program to demonstrate the accessibility of the members. 23..Write a program to generate a series of Fibonacci numbers using a copy constructor where the copy constructor is defined out of the class declaration using scope resolution operator. 24..Write program for a library database using class and with the following data items: Title of Book Acc Number Author Publisher Price Write the class with both a constructor and a member function to initialize the data members. Take a static member to initialize the Acc Number. Increment that static member in the constructor so that each account number must be unique. Create 10 records Polymorphism function overloading operator overloading prefix/postfix increment and decrement operator 25.WAP of function overloading. 26.WAP for temperature conversion using function overloading 27. WAP of operator overloading (unary and binary) 28. WAP of prefix/postfix increment and decrement operator Namespace 29.. WAP using namespace 30. WAP of name mangling Unit III Inheritance virtual function virtual base class 31. WAP of single level inheritance

32.Write a program in C++ using the concept of a) Multiple inheritance b) Multilevel inheritance c) Hierarchial inheritance d) Multipath inheritance e) Hybrid inheritance 33.Implement the following class hierarchy. Define all the three classes and write a program to create, update, and display the information of each class. Assume attributes for each class yourself. Person Student Employee 34. WAP of hybrid inheritance using virtual base class to remove ambiguity 35. WAP of pure virtual function. 36. WAP of virtual destructor. 37. WAP of pointer to objects. File handling Exception Handling 38. Write a program to read data from one file and display on the console. Also calculate the length of the file. 39. Write a program open two file in read mode and write the data from both the files in the third file. 40. WAP of Exception class. 41. Implement and exception handling mechanism which reports stack full and empty mechanism for a class called stack. Unit IV Template Stack linklist using template Binary Search tree using template Doubly linklist using Template 42. WAP of template function 43. WAP of template class 44. WAP of stack using template Write a Stack Class. Create the Stack using different option, Empty Stack, Stack with one item and stack with multiple items. Write the function to add and delete item in the stack. Verify if the Stack is full or empty at the time of addition and deletion of items.

45. WAP of singly linklist using template .Implement a Linked List Class write the function to Insert and Delete the node at the provided position. Inherit the Linked List Class in Stack Class using Private Inheritance and use the function Insert and Delete Node of the Linked List class to implement the Push and Pop Functionality of Stack class. 46. WAP of Doubly linklist using template 47. WAP of Binary Search tree using template Write C++ code to perform following operations on Binary Search Trees: i) Addition of a node ii) Deletion of a node iii) Traversal a) Pre-order b) In-order c) Post-order STL BFS using STL functions DFS using STL functions 48. WAP of BFS using STL functions 49. WAP of DFS using STL functions 50.Write a program using STL to a) create a vector b) store the information in the vectors using push_back function c) Sort the information in the vectors