Vivekananda Institute of Professional Studies: C++ - List of Programs BCA Code - 209
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.
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.
13. WAP to implement call by reference by creating Account class. [Hint. Assume necessary
functions]
15. WAP to implement operator overloading with string class functions (strcpy, strconcat etc.)
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)
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
30. Implement the following data structures using C++: (You can also use templates)
Linked List, Stack and Queue