This repository contains C++ programs for beginners to learn and practice concepts of C++ programming language. It includes basic C++ programs and practical file questions of semester 3.
The Basics folder contains some basic C++ application-based programs.
The Practical File of Semester 3 folder contains the following questions:
Write a program to find the area (function name AREA) of circle, triangle and rectangle by Function overloading concept.
Consider an example of a bookshop which sells books and video tapes. These two classes are inherited from a base class called media. The media class has command data members such as title and publication. The book class has data members for storing the number of pages in a book and tape class has playing time in a tape. Each class will have member functions such as read() and show(). In the base class, these members have to be defined as virtual functions. Write a program to model the class hierarchy for the bookshop and processes objects of these classes using pointers to base class. Write the rules of virtual functions.
Design three classes: Student, Exam, and Result. The Student class has data members such as roll no, name, etc. 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 class Exam and it has its own members such as total marks. Write an interactive program to model this relationship.
Write a program in which length is measured in feet and inches. The user enters two values of lengths then a menu will be displayed for performing the following operations on it. Use operator overloading for all the functions:
- Add two lengths: + operator
- Compare the lengths using < operator
- Compare the lengths using == operator
- Use *= operator to multiply the length with the given integer value
Create a class Person which includes: character array name of size 64, age in numeric, character array address of size 64, and total salary in real numbers (divide salary into different components, if required). Make an array of objects of class Person of size 10. a. Write an inline function that obtains the youngest and eldest age of a person from a class person using arrays. b) Write a program to develop the salary slip and display result by using constructors.
Define a class Shape whose attributes are radius, length, and width. Calculate the perimeter of the rectangle and circle. Use constructors and destructors.
Write a program to show the use of the this pointer.
Write a program to implement stack functions using templates.
Create two strings S1 and S2. Implement the following operations and write the output of each operation:
- Copy the content of S1 to S3.
- Find any substring in S2.
- Compare S1 and S2.
a) Write a program to swap two numbers (create two classes) by using a Friend function. b) Write a program to create two classes DistM and DistF which store the values of distance. DistM stores distance in meters and centimetres and DistF stores distances in feet and inches. Read values for the class object and add one object of DistM with another object of DistF. Use a friend function for the addition operation and display answer in meter and centimetres
1. Clone the repo:
git clone https://github.com/NebulaTris/CPP-Learning-Journey.git
2. Navigate to the cloned directory:
cd CPP-Learning-Journey
3. To access the basic C++ programs, navigate to the "Basics" folder.
4. To access the practical files for semester 3, navigate to the "Practical File " folder and choose the program you want to run.
5. Compile and run the chosen program using a C++ compiler.
6. Follow the instructions provided in the program and provide the required input.
7. View the output generated by the program.
8. You can also modify the programs to explore and experiment with different aspects of C++ programming.
That's it! You should now be able to use the "CPP Learning Journey" repo to learn and practice C++ programming.