Wednesday 6 March 2019

Extra CPP Program


1)WAP to create 2 array class using friend function and find out which array is smallest.

2)WAP to to create class and using operator overloading >,!=,+

3)WAP to  Create a class Array which contains – int *ptr – int n Write a menu driven program : – to Accept an array from user – to display it. – to add two arrays using operator overloading. – to subtract two arrays using operator overloading.

4)WAP to class Maximum to perform following function as:
3)intmin(int arr[],int n)

5)WAP to Create a class Fraction containing data members as Numerator and Denominator.                        
Write a C++ program to overload operators ++ , -- and * to increment , decrement a Fraction and multiply two Fraction respectively.(Use constructor to initialize values of an object). 

6)Write a c++ program to create a class Worker with data member as Worker_name,No_of_hours_worked,Pay_Rate. Write necessary member  function to calculate and display the salary of worker.(Use defalut value for Pay_rate). */

7)Write a C++ program to create a class Integer. Write necessary member  functions to overload the operator unary pre and post increment '++' for an integer number. */

8)WAPto create a matrix using M3=M1+M2   

9)Write a C++ program to sort integer and float array elements in ascending order by using function overloading.

10)Write a C++ program to create a class which contains two dimensional integer array of size mXn. Write a member function to display sum of all elements of entered matrix. (Use Dynamic Constructor for allocating memory and Destructor to free memory of an object)


11)Command line argument Prgram using file handling

12)WAP to use operator  !,[] using class

13)WAP to using class distance-member attributes  km,m ,use operator +=,>

14)Write a C++ program to create a class Integer. Write necessary member  functions to overload the operator unary pre and post decrement '--'  for an integer number. 

15)Write a C++ program to create a class Department which contains data members as Dept_Id, Dept_Name, H.O.D., Number_Of_staff. Write necessary member functions to

16)Write a C++ program to accept length and width of a rectangle. Calculate and display perimeter as well as area of a rectangle by  using inline function.

17)Writea C++ program to sort integer and float array elements in  ascending order by using function overloading. 

18)Writea C++ program to create a class which contains two dimensional integer array ofsize mXn. Write a member function to display sum of all elements of enteredmatrix. (Use Dynamic Constructor for allocating memory and Destructor to freememory of an object)





32)Function volume() is overload three times

33)count the no. of words in a file

34)C++ PROGRAM Program to explain Constructor, Destructor, Copy constructor and Assignment operator overloading  

35)Write a C++ program using class to calculate square and cube of given number using inline function.

36)Program to accept two distance figures from the user,compare them and display the larger using inline function

37)Program to accept two distance figures from the user compare them and display the larger using inline function  

38)Write a C++ program to accept length and width of a rectangle. Calculate and display perimeter as well as area of a rectangle by  using inline function.


39)Write a C++ program using class with data member’s int feet, float inches to represent distance and define function that takes two distance values as arguments and returns the larger one. Include a main program that accepts two distance figures from the user compare them and displays the larger using Inline
function. 


40)write a menu driven program using class to perform all arithmetic   operations(+,-,*,/) using inline functions

41)Write a C++ program to find area and volume of a cylinder using  inline function. 

42)wap menu driven using class to cal area and volume of rectangle using inline function

43)Write a C++ program using class which contains two data members of  type integer. Create and initialize the object using default  constructor,parameterized constructor, and parameterized constructor      with default value. Write a member function to display maximum from  given two numbers for all objects.

44)Write a C++ program to create a class Item with data members Item_code, Item_name,Item_price. Write member functions to accept and display   Item information also display number of objects created for a class. (Use static data member and Static member function) 

45)Write a C++ program to create a class which contains two data members. Write member functions to accept,display and swap two entered numbers   using call by reference. 

46)Write a C++ program to create two classes Class1 and Class2. Each  class contains one float data member. Write following functions:     i.To accept float numbers.     ii.To display float numbers in right justified format with precision       of two digits.     iii.To exchange the private values of both these classes by using        friend function. 

47)Create a class ComplexNumber containing members as:
     - real
     - imaginary
     Write a C++ program to calculate and display the sum of two complex
     numbers.(Use friend function and return by object) 


  48)Create a class Time which contains data members as:Hours,Minutes and      Seconds. Write a C++ program to perform following necessary member     functions:     i. To read time.     ii. To display time in format like: hh:mm:ss     iii.To add two different times(Use Objects as argument).  

49)Write a C++ program to calculate maximum of two integer numbers of  two different classes using friend function. 

50)Write a C++ program to create a class Book which contains data members  as B_id,B_name,B_author,B_publication. Write member functions to  accept and display Book information also display count of Books. (Use static data member to maintain Count of Books.) 









52)wap using class to cal simple interest amt use  default  value for rate

53)Create a class phone having data members:1. The STD code    2. The Exchange code      3.    Phone NumberEx :- 212-766-8901Write a C++ program to accept details from user (max 10) and change input phone number to new phone number using following criteria:a)Add 1 to 1st digit of STD code.  (If digit is 9 it becomes 10)b) The exchange code is retained as it is.c)  In 3rd  part of structure, 1st two digits should be reversed.Ex: I/P : 212-766-890 => O/P : 312-766-980Display all changed phone numbers.

54)Create a C++ class for inventory of books containing author, title, price, and publisher and stock as data members. Book can be sold, if stock is available, otherwise purchase will be made. Write necessary member functions for the following:
    1. To accept details from user.
    2. To sale a book. (Sale contains book details & number of copies to be sold.)
    3. To Purchase a book. (Purchase contains book details & number of copies to be purchased)       
(Use new operator to allocate memory).



55)Write a c++ program to define function power to raise a  number m to a power n the function takes a double value for m. &   integer value for n & return the result correctly use a default    value of 2 for n to make  the function calculate squares  when this argument is omitted. 

56) Consider the following C++ class
                 Class Person
                {
                               char Name [20];
            char Addr [30];
            float Salary;
             int Property;    //in sq. foot area
            float tax_amount;
                           Public:
                           // member functions
                 };

   56) Calculate tax amount by checking salary and the property of the person
         For salary <5000                tax rate=0
                        For salary >=5000||<=10000              tax rate= 14% of salary.
                        For salary >=10000                               tax rate =16% of salary.

    In this tax amount add following amt depending on the size of area in sq.foot
                     For 1000 sq. foot area             amt=0.
                     For >1000|| < 5000 sq. foot area     amt= 1000
                     For >5000||<= 10000 sq. foot area     amt=3000.
                                        


57)Consider the following class Person                 Class Person                 {                               char Name [20];            char Addr [30];            float Salary;             int Property;    //in sq. foot area            float tax_amount;                           Public:                           // methods                  };    Calculate tax amount by checking salary and the property of the person         For salary <5000                tax rate=0                        For salary >=5000||<=10000              tax rate= 14% of salary.                        For salary >=10000                               tax rate =16% of salary.    In this tax amount add following amt depending on the size of area in sq.foot                      For 1000 sq. foot area             amt=0.                     For >1000|| < 5000 sq. foot area     amt= 1000                     For >5000||<= 10000 sq. foot area     amt=3000. 

58)Imagine a tollbooth at a bridge. A Car passing by the booth is expected to pay a toll. The tollbooth keeps the track of the number of cars  that gone by and the total amount of cash collected.
Create a class tollbooth with the data members as:--total number of cars passed.    -total toll collected.
Write necessary member functions:
    1. a constructors that initializes both data members to zero.
    2. paying car(): when any car passes through  the tollbooth, that much toll gets added
        into  total toll collected and total number of cars passed is incremented by one.
    3. nonpaying car(): increments the car  total but adds nothing to cash total.
    4. display (): displays total no. of cars  passed and the total amount collected.








60)Create a class Telephone containing name,telephone no. & city as data members & write necessary member functions for  the following- - Search the telephone number with given name - Search name with given telephone number - Search all customers in a given city. (Use given city)

61)create class part using constructor accept,display().

62)Create a class Telephone containing name,telephone no. & city as data members & write necessary member functions for  the following- - Search the telephone number with given name - Search name with given telephone number - Search all customers in a given city. (Use given city) 

63) Create a class for inventory of books containing
 author, title, price, and publisher and stock as data members. Book can be sold, if stock is available, otherwise purchase will be made. Write necessary member functions for the following:
    1. To accept details from user
    2. To sale a book. (Sale contains book details & number of copies to be sold.)
    3. To Purchase a book. (Purchase contains book details & number of copies to be purchased)   
(Use new operator to allocate memory).


64)Program using class to    -accept details of all students    -to display details of one student    -to display details of all students 

65) Create a C++ class for student having following
members-Rollno,Name,No. of subjects,Marks of each subject
(no. of subjects varies for each student) Write a parameterized constructor
which initialises Rollno,Name & no. of Subjects & creates the array of marks
dynamically.Display the details of all  students with percentage & class obtained


66)Create a class time that contains hours, minute and seconds as data members. Write the member functions:1.  to add two object of type time, passed  as arguments .    2.  to convert a time into total number of seconds.    3.  to display the time into format like: 01:02:00

67) consider a class complex class complex { float real; float imaginary; public: }; overload operater ‘+’ to add object of two class use parameterized constructor for accepting value of complex number


68)Create a base class Student(Roll No, Name)  which derives two classes Test (Mark1, Mark2)and Sport(Score). Result(total marks, grade) class inherits both Test and Sport classes.Write a C++ menu driven program to perform the following functions:•Build a master table•    Calculate total of marks and grade •Display the details of all students in ascending order  of marks.

69)Define a class for a 3 dimensional points . Write necessary member functions  for accepting & displaying the point object. Overload the following operators: Operator Example Purpose + (Binary) p3=p1+p2 adds coordinates of point p1 to p2. – (Unary) -p1 Negates coordinates of point p1

70)C++ PROGRAM Program to explain Constructor, Destructor, Copy constructor and Assignment operator overloading


71)Write a C++ program to create a class Integer. Write necessary member      functions to overload the operator unary pre and post increment '++' for an integer number.  

72)Write a C++ program which will find the maximum of 3 integer numbers and maximum of 3 float numbers using function overloading.

73) Write a C++ program to create a class Integer. Write necessary member      functions to overload the operator unary pre and post decrement '--'  for an integer number.