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

C++ Program List

C++ progtam

Uploaded by

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

C++ Program List

C++ progtam

Uploaded by

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

Important C++ Programs for Final Exam

1. Write a C++ program to accept array of five elements, find and display
smallest number from an array.
2. Write a C++ program to find and display the smallest number of an array.
3. Write a program to sort an 1-d array in ascending order.
4. Write a ‘C++’ program to find factorial of given number using loop.
5. Write a C++ program to find whether the entered number is even or odd.
6. Write a program to print first n natural numbers and their sum using for loop.
7. Write a C++ program to add two 3 × 3 matrices and display addition.
8. Write a C++ program to declare a structure employee with members as empid
and empname. Accept and display data for one employee using structure
variable.
9. Write a program to declare a class ‘student’ having data members as
‘stud_name’ and ‘roll_no’. Accept and display this data for 5 students.
10. Write a C++ program to find the area of rectangle using class rectangle which
has following details – i) Accept length and breadth from the user.
ii) Calculate the area
iii) Display the result.
11. Write a C++ program to declare a structure book with members as book id and
name. Accept and display data of five books using array of structure.
12. Write a program to declare a class ‘book’ containing data members as ‘title’,
‘author-name’, ‘publication’, ‘price’. Accept and display the information for
one object using pointer to that object.
13. Write a program to declare a class ‘item’ containing data members as
‘item_name’, ‘code’, ‘price’. Accept and display the information for one object
using pointer to that object.
14. Write a program to declare a class ‘employee’ containing data members ‘emp-
id’ and ‘salary’. Accept and display this data for 10 employees.
15. Write a C++ program to declare a class COLLEGE with members as college
code. Derive a new class as STUDENT with members as studid. Accept and
display details of student along with college for one object of student.
16. Write a C++ program to declare a class college with name and code. Derive a
new class as student with members as name. Accept and display details of one
student along with college data.
17. Write a C++ program to declare a class mobile having data members as price
and model number. Accept and display the data for Ten objects.
18. Write a C++ program to declare a class ‘College’ with data members as name
and college code. Derive a new class ‘student’ from the class college with data
members as sname and roll no. Accept and display details of one student with
college data.
19. Write a C++ program to declare a class ‘Account’ with data members as accno,
name and bal. Accept data for eight accounts and display details of accounts
having balance less than 10,000.
20. Write a C++ program to declare a class ‘circle’ with data members as radius
and area. Declare a function getdata to accept radius and putdata to calculate
and display area of circle.
21. Write a C++ program to declare a class addition with data members as x and y.
Initialize value of x and y with constructor. Calculate addition and display it
using function ‘display.’
22. Write a C++ program to declare a class student with members as roll no, name
and department. Declare a parameterised constructor with default value for
department as ‘CO’ to initialize members of object. Initialize and display data
for two students.
23. Write a C++ program to declare a class train with members as train no and
name. Accept and display data for one object of train. Use pointer to object to
call functions of class
24. Write a C++ program to print multiplication table of 7. (example: 7 × 1 = 7 .....
7 × 10 = 70)
25. Write a C++ program to swap two integer numbers and swap two float
numbers using function overloading. (Hint : overload swap function)
26. Write a C++ program to find smallest number from two numbers using friend
function. (Hint : use two classes).
27. Write a C++ program to declare two classes with data members as m1 and m2
respectively. Use friend function to calculate average of two (m1, m2) marks
and display it.
28. Write a C++ program to overload add function to add two integer numbers and
two float numbers.
29. Write a C++ program to count number of spaces present in contents of file.
30. Write a program to count the number of lines in file.
31. Write a C++ program to write ‘Welcome to poly’ in a file. Then read the data
from file and display it on screen.
32. Write a C++ program to append data from abc .txt to xyz .txt file.
33. Write a program that copies contents of one file into another file.
34. Write a C++ program to find greatest number among two numbers from two
different classes using friend function.
35. Write a C++ program to overload binary operator ‘+’ to concatenate two
strings.
36. Write a program to swap two integers using call by reference method.
37. Write a program to overload the ‘—’ unary operator to negate the values.

Note : Remaining all programs from Inheritance Chapter which are in


your Homework Book.

You might also like