PROGRAMMING WITH C++
PRACTICAL FILE
NAME : KOLLATA VIDYA
ROLL NO. : 25/BAP/173
COURSE : B. A. PROGRAM(COMMERCE + COMPUTER
APPLICATIONS)
1. Write a program to compute the sum of the first n
terms of the following series:
The number of terms n is to be taken from the user
through the command line. If the command line
augment is not found then prompt the user to enter
the value of n.
Output :
1. Write a program to remove the duplicates from an
array.
Output :
2. Write a program that prints a table indicating the
number of occurrences of each alphabet in the text
entered as command line arguments.
Output :
3. Write a menu driven program to perform string
manipulation (without using inbuilt string functions):
a. Show address of each character in string.
b. Concatenate two strings.
c. Compare two strings.
d. Calculate length of the string.
e. Convert all lowercase characters to uppercase.
f. Reverse the string.
g. Insert a string in another string at a user specified
position.
Output:
4. Write a program to merge two ordered arrays to get
a single ordered array.
Output:
5. Write a program to search a given element in a set
of N numbers using Binary Search,
a. With recursion
Output:
b. Without recursion
Output:
6. Write a program to calculate GCD of two numbers,
a. With recursion
Output :
b. Without recursion
Output :
7. Create a Matrix class. Write a menu driven program
to perform following Matrix operations (exceptions
should be thrown by the functions if matrices
passed to them are incompatible and handled by
the main() function):
a. Sum
b. Product
c. Transpose
Output :
8. Define a class Person having name as a data
member. Inherit two classes Student and Employee
from Person. Student has additional attributes as
course, marks and year and Employee has
department and salary. Write display () method in all
the three classes to display the corresponding
attributes. Provide the necessary methods to show
the run time polymorphism.
Output :
9. Create a Triangle class. Add exception handling
statements to ensure the following conditions: all
sides are greater than 0 and the sum of any two
sides is greater than the third side. The class should
also have overloaded functions for calculating the
area of a right angled triangle as well as using
Heron’s formula to calculate the area of any type of
triangle.
Output :
10. Create a class Student containing fields for Roll
No., Name, Class, Year and Total Marks. Write a
program to store 5 objects of Student class in a file.
Retrieve these records from the file and display
them.
Output :
11. Copy the contents of one text file to another text
file, after removing all white spaces.
Output :