0% found this document useful (0 votes)
172 views4 pages

Complete The Following List of Program For Practical Files

The document contains 31 programming problems related to C++ concepts like functions, classes, inheritance, arrays, strings, searching, sorting, stacks, queues, matrices, files handling etc. The problems cover basic to advanced level C++ programming concepts. Students need to write C++ programs to solve these problems as part of their practical file for Computer Science subject.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views4 pages

Complete The Following List of Program For Practical Files

The document contains 31 programming problems related to C++ concepts like functions, classes, inheritance, arrays, strings, searching, sorting, stacks, queues, matrices, files handling etc. The problems cover basic to advanced level C++ programming concepts. Students need to write C++ programs to solve these problems as part of their practical file for Computer Science subject.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

DAV PUBLIC SCHOOL, PRATAP VIHAR, GHAZIABAD

CLASS-XII,2019-2020
SUBJECT-COMPUTER SCIENCE OLD(283)

COMPLETE THE FOLLOWING LIST OF PROGRAM FOR PRACTICAL FILES.

1. Write a C++ program that uses an area() function for the calculation of area of a triangle,
rectangle,square and circle . Use function overloading concept for it.

2.Write a C++ program to Define a class outfit in C++ with the following description
Private : OCode of type string
OType of type string
OSize of type string
OFabric of type string
Price of type float
A function InitPrice( ) which calculates and assign the value of OPrice as follows:
For the value of OFabric as “DENIM”
Type Price
TROUSER 1500
JACKET 2500
For the material other than “DENIM” the above mentioned Price gets reduced by 25%.
Public:
A function Input() to input the values of the data members OCode, OType, OSize and OFabric
and invoke the function Init( ).
A Display function that display the content of all the data members for the Outfit.
3. Write a C++ program for a class STUDENT with 3 data members:
Name, Roll Number, Marks of 5 subjects, Stream
and member functions to input and display data. It also has a function member to assign stream
on the basis of the table given below:
Average Marks Stream
96% or more Computer Science
91% – 95% Electronics
86% – 90% Mechanical
81% – 85% Electrical
75% – 80% Chemical
71% – 75% Civil
Write a program to define a structure STUDENT and input the marks of n (<=20) students and
for each student allot the stream.

4. Write a C++ program for a distance class with data members feet and inches of integer type.
Getdata , printdata are function to get and print data values and a function sum to add distance
with current distance object and return is value.
5. Define a POINT class for two-dimensional points (x, y). Include a default constructor, a copy
constructor, a negate() function to transform the point into its negative, a norm() function to
return the point’s distance from the origin (0,0), and a print() function besides the functions to
input and display the coordinates of the point.Use this class in a menu driven program to perform
various operations on a point.

6. Write a program using the point class to define an array of 10 points and input the data in the
array. Then for each point tell if it lies on any axis (x or y).

7. Write a C++program to implement a Time class. Each object of this class will represent a
specific time of day, storing the hours, minutes, and seconds as integers. Include a constructor,
access functions, a function advance(int h,int m,int s) to advance the current time of an existing
object, a function reset(int h,int m,int s) to reset the current time of an existing object, and a
print() function.

8. Write a C++ program to Create a class PERSON with the following specification.
Private: Data members: name- character string, ph long.
Public: A constructer that initializes the name as ‘NULL’ and phone number as 0.
Getdata() – to get all values from user.
Putdata()- To display all data .
A destructor to destruct all construction.
Given that ‘person class above wirte the declaration of class Spouse that inherits from class
Person and does the following.
(i) It has an extra data member – spousename.
(ii) Redefine getdata and Putdata function.
Now create another class Children that inherits from spouse and does the following:
(i) It has an extra data member childname.
(ii) Redefine getdata and Putdata function.
Now create objects of all three classes and call Getdata() and Putdata() .

9. Create a class student with data members name, class, section, roll No. and function members
getdata(), printdata(), and promote(). From this class derive a class ‘Sr_std’ with additional data
member stream. Also include another function member change_stream().Use these classes in a
program.

10.Write a C++ program to read and Display information about employees and manager.
Employee is a class that contains employee number, name, address and department. Manager
class contains all information of the employee class and list of employees working under a
manager.

11. Write a program to input the name of a text file from the user and display:
a) The number of blanks present in the file.
b) The number of lines present in the file.
c) The number of capital alphabets present in the file.
d) The number of small alphabets present in the file.
e) The number of lines starting with a capital alphabet.
f) The number of words present in the file.
g) The number of digits present in the file.
h) The number of words ending with a vowel
12. Write a program to input a text file name, read the contents of the file and create a new file
named COPY.TXT, which shall contain only those words from the original file which don’t start
with an uppercase vowel (i.e., with ‘A’, ‘E’, ‘I’, ‘O’, ‘U’). For example, if the original file
contains
The First Step To Getting The Things You Want Out Of Life is This: Decide What You Want. –
Ben Stein
Then the text file COPY.TXT shall contain
The First Step To Getting The Things You Want Life is This: Decide What You Want. – Ben
Stein
13.Write a C++ program to count the presence of words ‘do’ and ‘you’ in a text file
“MEMO.txt”
14.A blood bank maintains a data file that contains the following information for
every donor: Name, Date of Birth, Telephone number, Blood group. Write a
program in C++ to do the following:
1) Given a blood group, display name, date of birth and phone number of all the
persons of the given blood group.
2) Append records in the file.
3) Input a telephone number and modify the corresponding record.

15. Write a menu driven program in C++ to perform the following functions on a binary file
“BOOK.DAT” containing objects of the following class:
class Book

{ int BookNo;

char Book_name[20];

public:

// function to enter book details

void enterdetails();

//function to display Book details

void showdetails();

//function to return Book_no

int Rbook_no() {return Book_no;}

//function to return Book_name

int Rbook_name() {return Book_name;}};

1. Append Records
2. Modify a record for a given book no.
3. Delete a record with a given book no.
4. Search for a record with a given Book name
16. Write a menu driven program in C++

i) for copy one string into another string using pointer

ii) for concatenate two string using pointer

iii) to calculate string length using pointer

iv). Write a program in C++ to find given pattern in a string

17. Write a program in C++ to search a number in a given array using linear search

18. Write a program in C++ to search a number in a given array using binary search

19. Write a program in C++ to reverse element of an given array such that 1 position element in last
position 2 position element in second last and so on

20. Write a program in C++ to merge two array one in ascending order other in descending order into
third array in a sorted order
21. Write a program in C++ to right shift all odd element and left shift all even element

22. Write a program in C++ to display both diagonal elements of a 2D array.

23. Write a menu driven program in C++ to i)add ii) subtract and iii) multiply two matrix

24. Write a program in C++ to display largest and second largest element of a 2D array.

25. Write a program in C++ to display sum of rows and sum of column of a 2D array.

26. Write a program in C++ to sort an array using i)bubble selection, ii)insertion sort and iii) Selection
Sort.

27. Write a menu driven program in C++ to implement stack with array. It should have push(), pop() and
traverse() functions

28. Write a menu driven program in C++ to implement Queue with array. It should have insertQue(),
deleteQue() and traverse() functions

29. Write a menu driven program in C++ to implement stack with link list. It should have push(), pop()
and traverse() functions

30. Write a menu driven program in C++ to implement Queue with link list. It should have insertQue(),
deleteQue() and traverse() functions

31. Write a menu driven program in C++ to implement Circular Queue with array. It should have
insertQue(), deleteQue() and traverse() functions

You might also like