Programming in C++

Syllabus, Assignments Questions

Section 1 - C++ Introduction
- C++ Introduction - Object Oriented Programming (Why C++)? - Features of Object Oriented Programming - Input and Output - Manipulators in C++ - Dynamic Memory Allocation - Memory Management Operator - new ,delete. - Reference Data type - Structure and Class differences in C++ - Scope Resolution. - Constant and Reference Variable.

S.No Question
*1. Write a program to find largest number among 3 numbers.
*2. Write a program to draw given pattern.
5
5 4
5 4 3
5 4 3 2
5 4 3 2 1
*3. Write a program to demonstrate reference variable concepts.
*4. Write a program to find whether the given number is palindrome or not.
S.No Question
#1. Write a program to find out square of a given number.
#2. Write a program to find out area of a circle.
#3. Write a program accept 5 subject marks (Hint P=67, C=87, M=90, H=98, E=88) and calculate total marks and percentage.
#4. Write a program that accepts three numbers from users and calculate average of a given three numbers.
#5. Write a program to accepts an amount in rupees (Hint Rs4567) and find out how many currency of Rs 2000 required. Also find remaining amount.
#6. Write a program to convert temperature from degree Fahrenheit to Celsius.
#7. Write a program to convert days into years, weeks and months.
#8. Write a program to flip bits of a binary number using bitwise operator.
#9. Find sum of first , third and fifth digit of 6 digit number.
Section 2 - Functions
- Call by Value & Call by Reference. - Function with default arguments. - Inline Functions. - Friend function - Friend Class - Static Data members & Static member functions - Macros - Method Overloading. - Compile time polymorphism

S.No Question
*1. Write a program to swap two number using call by reference. & call by value.
*2. Write a program to calculate simple interest using function which having default value of time is 2 unit.
*3. Write a program to overload the method for addition of 2 integer number , 3 integer number and 2 float numbers.
*4. Write a program to create macros for square of given numbers.
*5. Write a program for finding the largest number among 3 numbers with help of inline function.
S.No Question
#1. Write a program to create two method for printing the salary one with bonus and other without bonus.
#2. Write a program to find the minimum between 2 integer ,2 double & 2 character. Using methods.
#3. Write a program to calculate the area of circle & rectangle with help of method overloading.
#4. Ask the price of an item with total number of item to calculate the total price from these two entity with default value of unit is 10.
#5. Write a program to change the number by 250 which is entered by user. Use call by reference & call by value.
#6. Write a program to create a macros for multiplication of 2 number.
Section 3 - Class & Object
- Introduction of Class & object. - Class Declaration and Member function definition - Member function with arguments & return values - Passing Class type parameters (object) as an argument. - Passing object as return type. - This Pointer in C++ - Accessing private member functions - Member function with Class type return values - Array of Objects - Using Array inside Class - Constructor (Introduction, Types, Overloading) - Constructor with default arguments - Destructor - Friend Function & Friend Class - Operator Overloading

S.No Question
*1. Write a program to create Class as a student having data member rollno(int),sname(string),fees(double) and member Function getDetail() and displayInfo().
*2. Write a program to create a class Employee that include three pieces of information as instance variablename (string),lastname(string),and monthly Salary(double).
a. Create a constructor in above class to initialize the three instance variable.
b. Create Display() Function.
c. Create two employee objects and display each object’s yearly salary.
d. Give each employee a 10% raise and display each employee yearly salary again.
*3. Write a program to create a class called Complex for storing complex number. The class have following function :
a. Constructor to initialize the data-member.
b. show() method for display properties of object.
c. void add(Complex) to add two complex number
*4. Write a program to create a class called Distance for storing kilometer & meter part. The class have following function :
a. Setter & Getter for storing & retrieving properties of class.
b. add() to add two distance with help of method of type return-type with arguments
*5. Write a program to create constructor and destructor of class named “test” to demonstrate the usage of both and tell total number of object present in memory.
*6. Write a program to find the maximum number between 2 different class.
*7. Write a program to Sum of n number of odd natural numbers by using friend class.
*8. Create a class Employee with(empNo ,salary and totalSalary) ) with following features.
a. Only parameterized constructor;
b. totalSalary always represent total of all the salaries of all employees created.
c. empNo should be auto incremented.
d. display total employees and totalSalary using class method.
*9. Write a program to add two complex number using operator overloading.
S.No Question
#1. Create a class to calculate Area of circle with one data member to store the radius and another to store area value.
Create method members
1. init - to input radius from user
2. calc - to calculate area
3. display- to display area.
#2. Create a class MathOperation with two data member X and Y to store the operand and third data member R to store result of operation.
Create method members
a.init - to input X and Y from user
b. add - to add X and Y and store in R
c. multiply - to multiply X and Y and store in R
d. power - to calculate X Y and store in R
e. display- to display Result R.
#3. Create a class Person with properties (name and age) with following features.
a. Default age of person should be 18;
b. A person object can be initialized with name and age;
c. Method to display name and age of person.
#4. Create class Product (pid, price, quantity) with parameterized constructor.
Create a main function in different class (say XYZ) and perform following task:
a. Accept five product information from user and store in an array
b. Find Pid of product with highest price.
c. Create method (with array of product’s object as argument) in XYZ class to calculate and return
total amount spent on all products. (amount spent on single product=price of product * quantity of product).
#5. C++ Program to print a pattern of the right-angle triangle using friend function with argument how many rows in triangle.
#6. Write a C++ program to find the number and sum of all integer between 100 and 200 which are divisible by 9 with friend function.
#7. Write a program to print the area and perimeter of a triangle having sides which is entered by user in a class named 'Triangle' with a function to print the area and perimeter.
#8. Create a class Vehicle The class should have two fields-no of seats and no of wheels Create two objects-Motorcycle and Carforthis class.Your output should show the descriptions for Carand Motorcycle.
#9. Create a class with a method.The method has to decide whether a given year is a leap year or not.
#10. Create a class with two functions-
One recursive and one nonrecursive. Either of these function should be capable of calculating the factorial of a number.
#11. Write a program to overload the subtraction operator using friend function.
#12. Write a program to overload the pre & post decrement operator.
#13. Write a program to make a friend function to 2 X the properties of Distance i.e kilometer & meter part using friend function.
#14. Write a program to swap the properties of two different class objects.
#15. Write a program to create a Class named Order to store order_id , order_name. Find the total number of order available.
Section 4 - Inheritance
- Introduction to Inheritance - Types of Inheritance. - Default Constructor in Inheritance - Destructors in Inheritance - Method Overriding - Run time Polymorphism - Diamond Problem - Virtual Base Class - Virtual Function - Abstract Base Class - Static v/s Dynamic Binding. - Local Class

S.No Question
*1. Write a program to implement single level Inheritance using school as a base class having function GetSchoolInfo() such as(sname(string),address(string),board(string)).
a.Create derived class as a Student having function GetStudentInfo() Such as rollno(int), name(string), class(int), fees(int).
Also create display() which display base and derived class data member.
*2. Create a class to calculate Area of circle with one data member to store the radius and another to store area value.
Create method members
a. init - to input radius from user
b. calc - to calculate area
c. display- to display area.
*3. Create a class MathOperation with two data member X and Y to store the operand and third data member R to store result of operation.
Create method members
● init - to input X and Y from user
● add - to add X and Y and store in R
● multiply - to multiply X and Y and store in R
● power - to calculate X Y and store in R
● display- to display Result R
*4. Enter the marks of 5 students in Chemistry, Mathematics and Physics (each out of 100) using a structure named Marks having elements roll no., name, chem_marks, maths_marks and phy_marks and then display the percentage of each student.
*5. Create a Bus child class that inherits from the Vehicle class. The default fare charge of any vehicle is seating capacity 100. If Vehicle is Bus instance, we need to add an extra 10% on full fare as a maintenance charge. So total fare for bus instance will become the final amount = total fare + 10% of the total fare.
*6. Create class Product (pid, price, quantity) with parameterized init. Create a main function in different class (say XYZ) and perform following task: a. Accept five product information from user and store in an array b. Find Pid of product with highest price. c. Create method (with array of product’s object as argument) to calculate and return total amount spent on all products. (amount spent on single product=price of product quantity of product).
S.No Question
#1. Write a Program to create Book Details using class.
#2. Write a C++ class named Rectangle constructed by a length and width and a method which will compute the area of a rectangle.
#3. Write a program to store and print the roll no., name, age, address and marks of 15 students using class.
#4. Create a bank account with support for deposit and withdraw operations as well as balance enquiry option.
#5. Write program to override the int method of RBI by 3 different child (SBI,PNB,CANARA).
#6. Create class OneBHK with instance variable roomArea , hallArea and price
a. Create default and parameterized constructor;
b. Method show(): to print OneBHK data member information;
Create another class TwoBHK which has all the properties and behaviour of OneBHK and a new instance variable room2Area.
a. Create default and parameterized constructor;
b. Method show(): to print all data member information;
Store three TwoBHK flat’s information and print information using show method. Also print total amount of all flats.
#7. Program to calculate Area of Circle , Triangle , Rectangle using concept of virtual Function. a.Create Shape as Base Class having Virtual Function GetData() and area().
#8. Program to create derived class such as (Two wheeler and Four wheeler) using Create BaseClass Vehicle having Virtual Function specification() and Display().
Section 5 - Advance Concepts
- Templates & Generic Class - Exception Handling - File IO - Stack & Queue.

S.No Question
*1. Write a program to display largest number among two number using function templates.(int , char , double).
*2. Write a program for sorting data (eg. Int data , float data).
*3. Write a program for Stack basic operation ( push , pop , peek ) etc.
*4. Create program for file to write customer information such as name , age , address.
*5. Create a program to read the customer information from customer.txt file.
S.No Question
#1. Write a program to swap two data using templates (int , char , double).
#2. Write a program for Queue basic operation (enQueue ,deQueue , getFront).
#3. Write a program to add two number using function templates.
#4. Write a program to print two numbers using function templates.

Contact Us

Our Address

Office no.- 401,Shekhar Central Building ,Palasiya, Pin-code:452001, Indore

Email Us

contact@codebetter.in

Call Us

+91 88230 75444, +91 99939 28766

Loading
Your message has been sent. Thank you!