LIST OF EXPERIMENTS FOR D - S and C - P LAB
LIST OF EXPERIMENTS FOR D - S and C - P LAB
50. Consider the graph G as shown in the above fig.. The adjacency list of G is
also given. Assume that G represents the daily flights between different cities and
we want to fly from city A to I with minimum stops. That is, find the minimum
path P from A to I given that every edge has a length of 1.
LIST OF EXPERIMENTS FOR COMPUTER PROGRAMING LAB
1. Write a program in C++ that inputs a three-digit number and outputs the sum of the digits.
2. Write a program in C++ to display whether an input year is Leap Year.
3. Write a program in C++ to swap values of two variables without using third variables.
4. Write a program in C++ to find the divisors of a natural number.
5. Write a C++ Program to Check Whether a Number is Palindrome or Not
6. Write a C++ Program to Convert Number in Characters
7. Write a C++ Program to convert decimal to binary.
8. Write a C++ program to print number triangle.
9. Write a C++ Program to print Alphabet triangle.
10.Write a C++ Program to Display Fibonacci Series
11.Write a C++ Program to Calculate Factorial Using Recursion
12.Write a program in C++ using Class that adds three numbers and displays total. (class Adder
program)
13. Write a C++ program to find the area of circle using class circle which have following details:
a. Accept radius from the user b. Calculate the area c. Display the result
14.Write a C++ program to define a class employee having members Emp-id, Emp-name, basic
salary and functions accept() and display(). Calculate DA=25% of basic salary, HRA=800, I-
tax=15% of basic salary. Display the payslip using appropriate output format.
15.Write a program in C++ using Class for Calculator.
16.C++ program to read time in seconds and convert in time format (HH:MM :SS) using class
17.Write a program in C++ using class to show constructor overloading.
18.Define a class to represent a bank account. Include the following members:
Data members: Member functions:
1) Name of the depositor 1) To assign initial values
2) Account number 2) To deposit an amount
3) Type of account 3) To withdraw an amount after checking the balance
4) Balance amount in the account. 4) To display name and balance.
Write a main program to test the program.
19.Write a program in C++ using Class that takes input the height, length, breadth of a Box and
displays Volume of two different Box. (Class Box)
20.Write a program in C++ using Class that displays a Menu to add, remove, display, display
Total for items and displays the Bill on output.
(Class Product).
21.Write a program in C++ using Class which shows function Overriding.
22.Write a C++ Program using class to demonstrate function overloading.
23.Write a program in C++ using class to show use of Friend function.
24.Write a program in C++ using class to show use of Friend Class.
25.Create a class staff having fields: Staff_id , name, salary. Write a menu driven program
for:(OPERATOR OVERLOADING)
1) To accept the data
2) To display the data
3) To sort the data by name
26. Create a class for an electricity board that charges the following rates to users
a) For first 100 units : 40p per unit
b) For next 200 units : 50p per unit
c) Beyond 300 units : 60p per unit
All users are charged a minimum of Rs.500. If the total cost is more than Rs.250.00 then an
additional charges of 15% are added.
Write a C++ program using class to read the names of users & number of units consumed &
print out the charges with names.
27. Write a C++ program to create multilevel inheritance. (Hint: Classes A1, A2, A3).
28. Extend the time class program in 12 that uses the overloaded + operator to add two
times.
29. Assume that a Bank maintains two kinds of account for their customers, one called as
Saving Acc and another as Current Acc. The Saving Acc Provides compound interest and
withdrawal facilities but no check book facility. The Current Acc provides check book facilities
but no interest, also Current acc. Holders must maintain a minimum balance and if the balance
falls below this level a service charge is imposed. Create a Class Account that stores customers’
name, Acc No, and Acc Type. From this class derive the Classes Curr_Acc and Saving_Acc
and include necessary member functions to achieve the following Tasks:
1)Accept deposit form a customer and update the balance.
2) display the Balance
3) Compute Interest and deposit interest.
4)permit withdrawal and update the balance.
5)Check the min. balance, impose penalty and update the balance.
30. An Educational institution wishes to maintain the database of its employees. The database is
divided into a number of Classes whose hierarchical relation is shown, also minimum
information needed for each class is shown. Specify all classes and define functions to create
the database and retrieve the individual information.