Make your own free website on

Home   |  Viewing problem solution  |  About me



Maharishi Arvind Institute of Science and Management
MCA Batch 2002-2003
[IV Semester]

C++ programming language assignments (You can also download all programs as archive.)


Assignment Objective Source
1. Write an interactive program for computing the factorial of a given number factorial.cpp
2. Write a C++ program to add two vectors using dynamic allocation and deallocation of memory. vectsum.cpp
3. Write a program to check whether a given year is leap or not. leapyr.cpp
4. Write a program to convert a given binary number to its equivalent decimal number. bintdec.cpp
5. Develop a program to compute the roots of a quadratic equation. Use switch statement to handle different values of discriminate (b2-4ac). quadeq.cpp
6. Write a program to compute exponential value of a given number x using the series 1 + x/1! + x2/2!+... exponnt.cpp
7. Write a program to sort elements of an array of integers using,
(i) Bubble Sort, (ii) Linear Sort, and (iii) Shell Sort.
8. Write a program to perform following operations on string,
(i) Find out length, (ii) Copy, (iii) Combine two strings, (iv) Break up the string into two pieces (strings), (v) Case conversion, and (vi) Comparison.
9. Write a template based program to demonstrate multiple swap functions and function overloading. swptmplt.cpp
10. Write a program to solve Tower of Hanoi simulation problem using recursion.


11. Write a program to generate Fibonacci series using recursion. fibrec.cpp
12. Write overloaded function for computing area of a triangle, circle, and rectangle. areaolf.cpp
13. Write a program to implement recursive Binary Search. bnsrch.cpp
14. Write a program to process student data and generate a report using structures and functions. Accept rollno, name, branch and % marks from the user and then display them back as a report on the console. stustrrep.cpp
15. Create a class called Time that has separate member for hours, minutes and seconds each. One constructor should initialize it to zero and another one should to fix values. Member function should display the time in 12 hour clock system (11:59:59). A final member function should add two objects of type Time passed as arguments. timhms.cpp
16. Define a class Counter that contains a data-member count (int). Increment count using operator overloading (unary increment operator ++). unrinc.cpp
17. Create a class Distance that has separate data members for feet and inches. Use constructors. Add objects using member functions and this function should return a value of type Distance. distfi.cpp
18. Create a class Employee that contains a name and emp_no. Include a member function called getdata() for insertion of data into the object and another function putdata() for displaying back object's stored data. empinf.cpp
19. Write main() program to exercise this class and create an array of Employee. empinfarr.cpp
20. Write a program for manipulating co-ordinates in rectangular co-ordinate system. The class Point must include members such as x and y (as data members) and add(), sub() etc. (as member functions). rectpnt.cpp
21. Write a program to perform matrix manipulation operations (such as addition, subtraction, multiplication, comparison etc.) with a class Matrix that uses the concept of dynamic memory allocation. matmanip.cpp
22. Create Student class having roll_no, name as data members. Develop a program to create array of pointers to class's object and then display the students' details. arrptstd.cpp
23. Write a program for creating a doubly linked list. The program must support ordered insertion and deletion of a node. dllucpp.cpp
24. Write a program to overload required operators for a complex class to perform basic operations. opovrld.cpp
25. Write a program to overload arithmetic operators for manipulating vectors. vectoo.cpp
26. With String as base class derive a class Pstring that presents buffer overflow when too long string constant is used to initialize the string. The constructor in the derived class should copy MAXLIMIT – 1 characters into string, if the string constant is longer, entire constant otherwise. Write main() function to test with strings of different length. pstrclsiht.cpp
27. Write a program to create Graphics class hierarchy. Create an abstract base class called Figure and derive two classes – Open and Close from it. Declare two more classed called Polygon and Ellipse using the Close class. Create derived classes Line and Polyline from Open class. Define three objects (triangle, rectangle, and pentagon) of the class Polygon. All class must have appropriate member functions in addition to the relevant constructors and destructors. grpclhr.cpp

[a] Write a program having definition for structure (or class) which is used in creation and deletion of linked list.
[b] Using Distance class overload * (multiplication) operator so that two Distances can be multiplied together. Make it possible to write statements such as, dist1 = 7.5 * dist2.

[a] llucpp.cpp
[b] distoo.cpp
29. Define a class – Person with a data member – name (a character array). Derive two classes from it, namely – Student and Professor. Student class has a data member gpa (average grade point) of type float, and the Professor class has a data member numpubs (number of papers published) of integer type. All these classes contain function – outstanding() of type Boolean. Prepare a program to create a list outstanding students and professors (use virtual function). virtprs.cpp
30. Write a function template for finding the largest number in a given array. The array parameter must be of generic type. lrgstmplt.cpp
31. Write template based binary search function using recursive algorithm. bnsrtmplt.cpp
32. Write a program of file creation (text file). Enter string character by character in the file and then display them back. fchrbchr.cpp
33. Create a file stock.txt through a program which has a class Inventory (having data members – item code, item name and cost). Write data into the file using write() function and read them back (using read()). stckfil.cpp
34. Write a class called student. This class should have overloaded stream operator functions to save and retrieve objects of student class from file. Write an interactive program to manipulate objects of the students’ class with a file. soovrld.cpp
35. Write a program to maintain an employee database. It has to maintain information such as employee id, name, designation, qualification, and salary. The user must be able to access all details about an employee either by entering employee id or name. The program must have an option to support addition (of new records), updation, and deletion operations in addition to the query. empdbapp.cpp

All rights reserved. Copyright © 1999 - . Krishna Kumar Khatri.
Best viewed with Microsoft IE 6 or later, under 800x600 resolution with True Color (24-bit).