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

C++ Lab Assign

The document contains a list of programming tasks that involve various concepts such as inline functions, function overloading, classes, operator overloading, inheritance, templates, and file handling. Each task specifies a different programming challenge, including creating classes for managing student information, performing mathematical operations, and manipulating files. The tasks are designed to enhance understanding of object-oriented programming and data management in coding.
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)
2 views

C++ Lab Assign

The document contains a list of programming tasks that involve various concepts such as inline functions, function overloading, classes, operator overloading, inheritance, templates, and file handling. Each task specifies a different programming challenge, including creating classes for managing student information, performing mathematical operations, and manipulating files. The tasks are designed to enhance understanding of object-oriented programming and data management in coding.
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/ 2

List of Programs:

1. Write a program to take name, address as character array, age as int , salary as float and contains inline
functions to set the values and display it.
2. Using the concept of function overloading Write function for calculating the area of triangle ,circle and
rectangle.
3. Write a function power to raise a number m to power n. The function takes a double value for m and int
value for n. Use default value for n to make the function to calculate squares when this argument is
omitted.
4. Create a class TIME with members hours, minutes, seconds. Take input, add two time objects passing
objects to function and display result.
5. Write a program for multiplication of two matrices using OOP.
6. Create a class Student which has data members as name, branch, roll no, age ,sex ,marks in five subjects.
Display the name of the student and his percentage who has more than 70%.Use array of objects.
7. Write a program to enter any number and find its factorial using constructor.
8. Write a program to perform addition of two complex numbers using constructor overloading. The first
constructor which takes no argument is used to create objects which are not initialized, second which
takes one argument is used to initialize real and imag parts to equal values and third which takes two
argument is used to initialized real and imag to two different values.
9. Write a program to generate a Fibonacci series using copy constructor.
10. Write a program to find the biggest of three numbers using friend function.
11. Write a program to demonstrate the use of friend function with Inline assignment.
12. Write a program to find the greatest of two given numbers in two different classes using friend function.
13. Write a program to find the sum of two numbers declared in a class and display the numbers and sum
using friend class.
14. Write a program to overload unary increment (++) operator .
15. Write a program to overload binary + operator.
16. Create a base class basic_info with data members name ,roll no, sex and two member functions getdata
and display. Derive a class physical_fit from basic_info which has data members height and weight and
member functions getdata and display. Display all the information using object of derived class.

17. Create class first with data members book no, book name and member function getdata and putdata.
Create a class second with data members author name ,publisher and members getdata and showdata.
Derive a class third from first and second with data member no of pages and year of
publication. Display all these information using array of objects of third class.
18. Design three classes STUDENT ,EXAM and RESULT. The STUDENT class has data
members such as rollno, name. create a class EXAM by inheriting the STUDENT class.
The EXAM class adds data members representing the marks scored in six subjects. Derive
the RESULT from the EXAM class and has its own data members such as totalmarks.
Write a program to model this relationship.
19. Create a base class called SHAPE. Use this class to store two double type values. Derive
two specific classes called TRIANGLE and RECTANGLE from the base class. Add to the
base class, a member function getdata to initialize base class data members and another
member function display to compute and display the area of figures. Make display a
virtual function and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept driven of a TRINGLE or
RECTANGLE interactively and display the area.
20. Write a program to define the function template for swapping two items of the various
data types such as integer ,float,and characters.
21. Write a program to define the function template for calculating the square of given
numbers with different data types.
22. Write a program to illustrate how template functions can be overloaded.
23. Write a program to illustrate how to define and declare a class template for reading two
data items from the keyboard and to find their sum.
24. Write a program to demonstrate the use of special functions, constructor and
destructor in the class template. The program is used to find the biggest of two entered
numbers.
25. Write a program to read a set of lines from the keyboard and to store it on a specified file.
26. Write a program to read a text file and display its contents on the screen.
27. Write a program to copy the contents of a file into another.
28. Write a program to read the class object of student_info such as name , age ,sex ,height
and weight from the keyboard and to store them on a specified file using read() and write()
functions. Again the same file is opened for reading and displaying the contents of the file
on the screen.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy