C++ Programs List

Program 1: WAP to print the sum and product of digits of an integer.

Program 2: WAP to reverse a number.

Program 3: WAP to compute the n terms of the following series
S = 1 + 1/2 + 1/3 + 1/4 + …

Program 4: WAP to compute the n terms of the following series
S = 1 – 2 + 3 – 4 + …

Program 5: Write a function that checks whether a given string is a Palindrome or not and use it to check whether the string entered by user is a Palindrome.

Program 6: Write a function to find whether a given no. is Prime or not. Use the same to generate prime numbers less than 100.

Program 7: WAP to compute the factors of a given number.

Program 8: WAP to print the triangle of stars as follows (take number of lines from user)

Program 9: WAP to perform following actions on an array entered by the user:
a)Print the even-valued elements.
b)Print the odd-valued elements.
c)Calculate and print the sum and average of the elements of user.
d)Print the maximum and minimum elements of array.
e)Remove the duplicates from the array.
f)Print the array in reverse order.

Program 10: WAP that prints a table indicating the number of occurences of each alphabet in the text entered as command line arguments.

Program 11: WAP that swaps two numbers using pointers.

Program 12: WAP to generate pay-slip of salaried employee.

Program 13: Write a menu driven program to perform following operations on strings:
a)Show address of each character in string.
b)Concatenate two strings without using strcat function.
c)Concatenate two strings using strcat function.
d)Compare two strings.
e)Calculate the length of the string (use pointers).
f)Convert all lowercase characters to uppercase.
g)Convert all uppercase characters to lowercase.
h)Calculate the number of vowels.
i)Reverse the string.

Program 14: WAP using iteration
a)Display Fibonacci Series
b)Calculate Factorial of a number.
c)Calculate GCD of two numbers.

Program 15: Create Matrix class. Write a menu driven program to perform following Matrix operations (2-D array implementation):

Program 16: Create the Person class. Create some objects of this class (by taking information from the user). Inherit the class Person to create two classes Teacher and Student class. Maintain respective information in the classes and create, display and delete objects of these two classes. (Use Run Time Polymorphism).

Program 17: Create a class Triangle. Include overloaded functions for calculating area. Overload assignment operator and equality operator.

Program 18: Copy the contents of one text file to another file, after removing all whitespaces.

Program 19: Create a class Box containing length, breadth and height. Include the following methods in it:
a)Calculate Surface Area
b)Calculate Volume
c)Add, Overload + operator (to add two boxes length, breadth and height)
d)Overload operator = = (to check equality of two boxes), as a friend function
e)Overload Assignment operator
f)Check if its a cube or cuboid.
WAP which takes input from user for length, breadth and height to test the above class.

Program 20: Create a class Length containing feet and inch. Include following functions
a)Input Length object
b)Overload + operator (to add two lengths)
c)Overload – operator (to subtract two lengths)
d)Display Length object
WAP which takes input from user for feet and inch to test the above class.