C++ programs

Click on any program definition to open that program.. 
=======================================================================

1=> Declare a class called book_details to represent details for a book, having data members like title, author, edition, price and no_of_copies_available. Define following functions:- constructor(s)- display to display all data members- find_books to find and display details of all books having price less than Rs. 250- main to create an array of book_details and to show usage of above functions.

=======================================================================

2=> Write a program to find out sum and multiplication of two private data members x and y of two classes A and B using a common friend function. Assume that the prototype for both the classes will be void sum (A, B); 

========================================================================

3=> Declare a class called bird having private data members name and weight. Define following functions : - default constructor for reading data members from key board - overloaded constructor with two arguments to be used for initialization of data members. - display function to display data members. - overloaded member operator >= to compare weight of two bird objects, returning false if weight of first bird object is less than that of the second & true otherwise. Define main to illustrate use of above functions

=======================================================================

4=> Declare a class called book having members like book_title, publisher and author_name. Overload extractor and insertion operators ( >> and << ) for class book

=======================================================================

5=> Create a class coordinate containing x, y and z private variables. Perform operations for incrementing, adding and comparing object(s) by overloading + +, + = and = = operators respectively. Define necessary functions to set and display the variables

=======================================================================

6=> Write a program to demonstrate conversion of an object of one class into an object of another class

======================================================================

7=> Write a program to create a class distance containing feet and inches. Using operator keyword, convert an object of class distance into total meters which is a float data type. (1 meter=3.28 feet) 

======================================================================

8=> What is Constructor? Write the characteristics of constructor function. DefineClass named point which represents 2-D Point, i.e P(x, y). Define Defaultconstructor to initialize both data member value 5, Parameterized constructor toinitialize member according to value supplied by user and Copy Constructor.Define Necessary Function and Write a program to test class Point.

======================================================================

9=> Create a class Account. It has three data member account id, name and balance.Define function to assign value and display value. Define function that searchaccount number given by the user. If account number exists, print detail of thataccount. Write a program using array of object. Declare at least 5 account andprint details.

========================================================================

10=> Create two classes DM and DB which store the value ofdistances. DM stores distances in meters and centimeters and DB in feet andinches. Write a program that can read values for the class objects and add oneobject of DM with another object of DB. Use a friend function to carry out theaddition operation. The object stores the results may a DM object or DBobject, depending on the units in which the results are required. The displayshould be in the format of feet and inches or meters and centimeters dependingon the object on display.  (1 Feet = 0.3048Meter,  1Meter = 3.28 Feet,  1Inch = 2.54 Centimeter,  1Centimeter = 0.3937 Inch)

========================================================================

11=> Define Operator overloading. Create class Time that has three data members hour, minute and second and two constructor, default constructor and parameterized constructor to initialize data member. Write a program to add two times by overloading operator +

======================================================================= 

 12=> Define a class Time with hours and minutes as two data members, addnecessary member functions to initialize and display data of class. Do not useconstructors in a class. Define a member function sum() which adds two Timeobjects. Invoke the statements like T3.sum(T1, T2) in main ()

=======================================================================

13=> Define a class matrix with an integer array of 3X3 as a data member. Define a friend function which adds two matrix objects and returns resultant matrix object.

=======================================================================

14=> Define a class complex with real and imaginary as two data member, addnecessary constructors and member function to initialize and display data ofclass. Class should overload the + operator to add two complex objects andreturn the results. Invoke the statements like C3=C1+C2 in main () 

=======================================================================

 15=>

=======================================================================

 16=>

=======================================================================

17=> Write a C++ program to explain Objects as function arguments. Define a class name VALUE with two data member variable, two member functions for inputting data and displaying the result. Define third member function that takes two objects as arguments and adds the objects

========================================================================

18=> Write a program in C++ to generate Fibonacci series by using recursion

=======================================================================

 19=> Declare a class called my string having char * ptr_str as a member, used to point to a string. define a constructor for initializing members. define an overloaded operator + to be applied on two operand of type class my_string for concating string pointed by str_ptr of operand. the resultant string is placed in a new object of type class my_string which is returned. define main to show the usage of these functions

========================================================================

20=> Consider a class network as shown in figure given below. The class Employee derives information from both Account and Admin classes which in turn derive information from the class Person. Define all the four classes and write a program to create, update and display the information contained in Employee objects

========================================================================

21=> The class Result derives information from the classes Internal, University and External respectively. The Internal and External classes access information from the Student class. Define all five classes and write a suitable program to create and display the information contained in Result object


                                      

========================================================================

22=> Declare a class called logic_gate to represent logic gates. The class has three data members - input1, input2 and input3 to represent three inputs to the logic gate. The class also has a virtual function member called get_gate_output. Derive two classes from the base class logic_gate, namely, and_gate and or_gate to represent ‘logical and gate’ and ‘logical or gate’ respectively. Define function get_gate_output in both of these classes to get the output of the gate. Show use of above classes.

========================================================================

 23=> Declare a class called item having data members item_code, item_name, cost and discount. Derive two classes from class item, namely employee and customer. The class employee has data members like employee_code, employee_name and amount. The class customer has data members like customer_name and amount. Define following functions for - initializing data members. - displaying the values of data members. - computing amount to be paid for a purchased item. Also define function main to show usage of these function.

========================================================================

 24=> Assume that Circle is defined using radius and Cylinder is defined usingradius and height. Write a Circle class as base class and inherit the Cylinderclass from it. Develop classes such that user can compute the area of Circleobjects and volume of Cylinder objects. Area of Circle is pie *radius*radius,while volume of Cylinder is pie*(radius * radius)*height

========================================================================

 25=>

========================================================================

 26=>

========================================================================

 27=>

========================================================================

 28=> Write a program that demonstrates use of multiple catch. Add at least three catch block in your Program

note:- if this program is not running in your Turbo C++, then it is because of its 'OLD COMPILER' problem. so, don't worry if there is an error in this program.(solution:- try running this program online)

========================================================================

 29=> Write a program to copy the contents of a source file student1.txt to a destination file student2.txt character by character.

========================================================================

 30=> Write a program which uses command line argument to copy the contents of a file A.txt into another file B.txt by reversing case of the characters. E.g. File A.txt: aBCd File B.txt: AbcD

========================================================================

 31=> Write a program that reads a text file and creates another file that is identical except that every character is in upper case

========================================================================

 32=> Write a program that reads a text file and creates another text file that is identical except that every letter must be converted to lower case irrespective of its original case (e.g ‘a’ or ‘A’ will become ’a’)

========================================================================

10 comments:

  1. Amazing work krunal bapodaria.

    ReplyDelete
    Replies
    1. Thank u, and share this contents, if u like.

      Delete
  2. Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). Web services provide a standard means of inter operating between software applications running on a variety of platforms and frameworks. Web Design Services

    ReplyDelete
  3. https://cscmoolakkadai.blogspot.com/p/honours-diploma-in-computer-programme.html?showComment=1649742695974

    ReplyDelete
  4. Thank you so much for this amazing blog. Keep sharing this type of content with us. If anyone wants to learn C/C++ in Delhi, I will recommend High Technologies Solutions training institute.
    For any further information please call +919311002620 or you can visit website https://htsindia.com/Courses/modular-courses/c-plus-plus-training-course

    ReplyDelete