0% found this document useful (0 votes)
101 views

Vivekananda Institute of Professional Studies: C++ - List of Programs BCA Code - 209

The document lists 31 C++ programming problems covering topics like classes, inheritance, polymorphism, operator overloading, templates, and data structures. Example problems include writing functions to calculate factorials, power, and reversing digits of two-digit numbers. Other problems involve defining classes like Account, Employee, and Shape with hierarchies, as well as implementing containership and data structures like linked lists, stacks and queues.

Uploaded by

Sahil Pathak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

Vivekananda Institute of Professional Studies: C++ - List of Programs BCA Code - 209

The document lists 31 C++ programming problems covering topics like classes, inheritance, polymorphism, operator overloading, templates, and data structures. Example problems include writing functions to calculate factorials, power, and reversing digits of two-digit numbers. Other problems involve defining classes like Account, Employee, and Shape with hierarchies, as well as implementing containership and data structures like linked lists, stacks and queues.

Uploaded by

Sahil Pathak
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Vivekananda Institute of Professional Studies

C++ - List of programs


BCA Code– 209

1. Pick a small program that you would like to solve via C++ program. Please make the
solution to the problem contain the following attributes:
• At least one function which takes in arguments and/or return values.
• Input from the user into a variable using the cin construct.
• Output to the user using the cout construct
.
2. Write a program (WAP) that asks the user to enter a temperature in degrees Fahrenheit,
and then prints out the equivalent temperature in degrees Celsius.

3. Write a function called factorial that returns the factorial of any positive whole number.
Your function is required to use recursion.

4. WAP to implement student result. [Hint: implement percentage () etc.]

5. WAP to implement friend function by taking some real life example.

6. Write a function twodigitreverse() that reverse the digit of a two-digit integer.

7. Write a class called CAccount which contains two private data elements, an integer
accountNumber and a floating point accountBalance, and three member functions:
• A constructor that allows the user to set initial values for accountNumber and
accountBalance and a default constructor that prompts for the input of the values
for the above data numbers.
• A function called inputTransaction, which reads a character value for
transactionType(‘D’ for deposit and ‘W’ for withdrawal), and a floating point
value for transactionAmount, which updates accountBalance.
• A function called printBalance, which prints on the screen the accountNumber
and accountBalance.

8. Create a class employee which have name, age and address of employee, include functions
getdata() and showdata(). Getdata() takes the input from the user and inserts in a file,
showdata() reads the same file to diplay the data in following format:
Name:
Age:
Address:

9. Define a class counter which contains an int variable count defined as static and a static
function Display () to display the value of count. Whenever an object of this class is created
count is incremented by 1. Use this class in main to create multiple objects of this class and
display value of count each time.

10. Write a function power () to raise n to the power p which takes a double value for n and int
for p, and returns the result as double. Use default argument 2 for p. Write a main() to test
the program.

11. WAP to multiply two complex numbers.

12. WAP to add two Minute and Hour values.

13. WAP to implement call by reference by creating Account class. [Hint. Assume necessary
functions]

14. WAP to implement Array of objects using suitable problem statement.

15. WAP to implement operator overloading with string class functions (strcpy, strconcat etc.)

16. WAP to implement ‘Inline function’.

17. WAP to show the usage of ‘Destructor’.

18. WAP to implement Copy Constructor to copy one string to another

19. WAP to implement ‘Function Overloading’.

20. Write separate programs to overload Unary ++ and Unary -- operators (Both using and
without using friend functions)

21. Write program to overload Binary + to concatenate two strings.(Both using and without
using friend functions)

22. WAP to implement += operator.


23. WAP to implement = operator.

24. Implement the following class hierarchy where class person contains name and age of
person and student class contains enroll.no. of student and the worker class contains social
security number of worker.

Person

Student Worker

Student-Worker

25. Declare two classes named NewWindow and door. Serve a new class called house from
those two classes. Take appropriate functions and data members to show the relationship.

26. Implement the following class hierarchy considering appropriate data members and
member functions.

Student

Test Sports

Performance

27. Implement the following hierarchy considering appropriate data members and member
functions (use Virtual functions).

Shape

Triangle Rectangle Circle


28. Create a vehicle class hierarchy with top most base having the following specifications:
Data Members: int reg_no, int cost
Member Functions: virtual void start () = 0; virtual void stop ()=0; virtual void show ();
Write a complete program having derived classes such as heavy, lightweight vehicle etc.

29. WAP to show the implementation of ‘containership’.

30. Implement the following data structures using C++: (You can also use templates)
Linked List, Stack and Queue

31. WAP to show swapping using template function(Generic)

You might also like