Object Oriented Programming Using C

++
1. 2. 3. 4. 5. 6. 7. Write a C++ program, which reads a five-digit number, and find the sum of its digits. Write a C++ program, which reads a five-digit number, and reverse that number. Write a C++ program, which reads a number, and find whether it is even or odd. Write a C++ program, which reads a number, and find whether it is prime or not. Write a C++ program, which reads a year and find whether the entered year is leap or not. Write a C++ program, which reads a number, and find the prime numbers from 1 to that number. Write a C++ program to read the numbers and find the largest between • Two numbers • Three numbers • Four numbers by using switch case statements. 8. Write a C++ program to print the following patterns using loops. 1) 1 12 123 1234 2) 1 23 456 7 8 9 10 1 212 32123 4321234 9. Write a C++ program to find sum of the first natural numbers: Sum = 1+2+3+…+100 by using • For loop • While loop • Do while loop 10. Write a C++ program to find sum of the following series using function declaration. Sum = x – (x)3/3! + (x)5/5! -.. (x)n/n! 11. Write a C++ program to read two matrixes and to perform the matrix multiplication. 12. Write a C++ program to exchange the contents of two variables using • Call by value • Call by address • Call by reference 13. Write a C++ program to find the factorial of a given number using recursive function. 14. Write a C++ program to generate a fibonacci series up to 10 terms using recursive function. 15. Write a C++ program to add two integers, two floats and two doubles using function overloading. 16. Write a C++ program to perform swapping of two data items of integer, floating point number and character type with the help of function overloading. 17. Write a C++ program to find the length of a string using pointers. 18. Write a C++ program to compare two strings using pointers. 19. Write a C++ program to concatenate two strings using pointers. 20. Write a C++ program to show the mark sheet of 10 students using structure. Mr. Dinesh Kumar Bhawnani, BITD, 9827475115 Page 1 3)

Write a C++ program that accept the name and basic salary of an employee and find their gross salary using command line arguments. (DA = 70% of basic salary & HRA = 10% of basic salary). • Subtraction of two matrixes. Write an OOP program to access the private data members of a class by non-member function where the function is declared: • Is the location of public category • Is the location of private category • Within the scope of class definition itself • Defined with inline code substitution. 22. • Multiplication of two matrixes. • Addition of two complex numbers. Write an OOP program. Data members • Name of the depositor Mr. calculate the smallest one and print the smallest one. 4. (For calculating the gross salary the DA is 70% of basic salary and HRA is 10% of basic salary). Write an OOP program to find the roots of a quadratic equation. 25. 8. Write an OOP program which reads two complex numbers and perform the following operations • Addition • Subtraction • Multiplication • Division 5. 10. Write an OOP program to find the maximum of data members of two different class using friend functions. Including the following members. 24. Classes & Objects 1. • Multiplication of two complex numbers. • Subtraction of two complex numbers. Write an OOP program which performs the following operations • Addition of two matrixes. 9827475115 Page 2 . Write an OOP program to read the name of 10 employees along with their basic salary and find their gross salary. Write an OOP program to define a class to represent a bank account. (DA = 70% of basic salary and HRA = 10 % of basic salary). Write a C++ program that accept a number and find the factorial of that number using command line arguments. Write an OOP program which reads two numbers and prints sum of these two numbers. 2. 7. Write a C++ program to find the sum of two numbers using command line arguments. Write a C++ program to input the name of an employee along with their basic salary and find his gross salary using structure. Dinesh Kumar Bhawnani. which reads two numbers. BITD. Write a C++ program to perform the following arithmetic operations of a complex number using a structure. 6. • Division of two complex numbers. 9. Write an OOP program to exchange the private data members of two different functions using friend functions. 3.Object Oriented Programming Using C++ 21. 23.

Write an OOP program to define a class whose constructor can be used to perform following functions: • Create un-initialized strings • Create objects initialized with a string Member Functions • To concatenate two strings and display the concatenated string • To display the contents of the objects 18. In case initial values are not provided. Write an OOP program which reads the bio-data of 10 employees of a factory and then print the bio-data of those employees whose salary is more than 15000. it should initialize the objects with default values. Write an OOP program which prints the object number whenever we create an object. Write an OOP program to define a constructor for a “Date” class that initializes the Date objects with initial values. 17. 30…) 12. Write an OOP program to count how many times a particular member function of a class be called by • A particular object • Any objects 16. Note that for storing account number use an array. BITD. The employee bio-data consist of following field • Name • Age • Gender • Designation • Salary • Experience 14. 9827475115 Page 3 .Object Oriented Programming Using C++ Account number Type of account Balance amount in the account Member Functions • To assign initial values • To deposit an amount. 20. 15. Dinesh Kumar Bhawnani. • To withdraw an amount after checking the balance • To display name and balance 11. 13. Write an OOP program to define a class for a book shop which has following Data Members • Book title • Name of the publisher • Stock position of the books • Book price in Rupees • Total sales in Rupees Member Functions • • • Mr. Include member functions to perform the following tasks: • To create the vector • To modify the value of a given element • To multiply by a scalar value • To display the vector in the form (10. Write an OOP program to define a class to represent a vector (a series of float values). Write an OOP program which reads the name of a person and five different account number of that and then find out account number 2323 is belong to that or not.

Write an OOP program to overload = operator to copy the contents of one string object to another string object. and copy that into another using copy constructor. 20. 24. Write an OOP program. Write an OOP program to generate fibonacci series by overloading • Prefix operator • Postfix operator Inheritance 28. 9827475115 Page 4 . 25. 22. Write an OOP program to overload unary – operator to change the sign of private data member of a class. Write an OOP program to create a class “Stdnt_base” which has the following members: • Student name • Department • Roll number • Semester Member Functions • To fill up the necessary data for every student • To search for the student using name as the key • To show all the information Create another class “Stdnt_Info” which should be derived from “Stdnt_base” and has the following members:• Marks of 5 subjects (out of 100) Mr. Write an OOP program to perform simple arithmetic operations of two complex numbers using operator overloading. 26. 27. Write an OOP program to overload < (less than) operator to find which of the two string object is greater and show the greater string object. Write an OOP program to generate a series of fibonacci numbers using the constructor where the constructor member function had been defines • Is the scope of class definition itself. Dinesh Kumar Bhawnani. which reads a complex number. Write an OOP program to concatenate two strings by overloading + operator using • Member function • Friend Function 23. Write an OOP program to overload = = operator to compare two strings.Object Oriented Programming Using C++ • To search for the book (using book title) • To sell the book and update the stock • To show the stock position • To show the total sales 19. BITD. Operator Overloading 21. • Out of the class definitions using the scope resolution operator. Also make this program with the help of the copy constructor.

Write an OOP program to demonstrate how ambiguity can be avoided using scope resolution operator in the following inheritance • • Mr. 9827475115 Page 5 . Dinesh Kumar Bhawnani. 29. Write an OOP program to create a class “Emp_data” which has the following members:• Employee name • Employee grade Member Functions • To input data • To display the data Create another class “Emp_personal” which has the following members:• Permanent address of the employee • Educational qualifications of the employee Member Functions • To fill up the data • To show the data Create another class “Emp_info” derived from “Emp_data” and “Emp_personal” whih has the following members:• Employee salary Member Functions • To fill up all the data (from name to salary) • To search for a particular employee (by name) • To display all the information about all the employees 30. Create a class “Accnt_amt” which has the following members:• Account number • Total balance amount in the account Member Functions • To fill data • To show data Create a class “Accnt_deposit” which has the following members:• Latest amount deposited Member Functions • To fill data • To show data Create a class “Accnt_withdraw” which has the following members:• Latest amount withdrawn Member Function • To fill only valid data • To show data Create a program which can be used o fill and withdraw any amount & search any account.Object Oriented Programming Using C++ Total marks Total percentage Member Functions • To fill up the necessary data • To calculate marks and percentage • To show the final report containing all the data (from name to total percentage) related to all the students. 31. BITD.

9827475115 Page 6 . Aggregate percentage and Division according to the following conditions: • Percentage above or equal to 60 – First division. The database should contain the Name. Write a program to Encrypt and Decrypt a text file. Design a base class which has following data:• Name • Rollno • Phno • Address Then design a derived class from above base class in derived class the data are:• Marks in first session • Marks in second session • Total marks The program which consist above base and derived class perform following operation • Create a database • Insert a new entry • Delete an entry • Modify entry • Print all the entry in database File Handling 34. BITD. Mr. Implement the above program using Structures. Write a program to copy the contents of one text file to another and display both the files.Object Oriented Programming Using C++ • Single Inheritance • Multiple Inheritance 32. 33. 35. Using a text Menu. Write a program to store every character typed on the keyboard in to a file. Marks of 5 subjects. Dinesh Kumar Bhawnani. Create a database of 10 students. Create a database for a Shop containing 10 items. • Percentage between 40 and 49 – Third division.Fail Display the above database of every student in a tabulated form. When the user presses the ESC key then the program should stop. Write a program to concatenate one file at the end of another and print both the files. 39. • Percentage between 50 and 59 – Second division. 37. The First part of the database should contain the Name of item. Write a Program to demonstrate how a pure virtual function defined declared and invoked from the object of derived class through the pointed of the base class. serial number of item. Write a program to count the number of words in a given text file. • Filling up the second part of the database related to the customer information. Text-Menu and File I/O operations. 38. Items purchased and total purchase. Using a text Menu. Create a Menu that should have the options of following types: • Filling up the first part of the database related to the items of the shop. Unit price of item and Sale of the day. • List of Item names with item serial number and corresponding unit costs. 40. The Second part of the database should contain the Customer name. 36. Using text menu. • Percentage below 40 . Aggregate Marks.

Write a OOP program to define and declare a class template for reading two data items from keyboard and to find the sum of the given two data items. Employee ID number. Text-Menu and File I/O operations. • Total Purchase done. Write a Program to Bubble Sort using template function. • If Basic salary greater than Rs5000. Implement the above program using Structures. 9827475115 Page 7 . • Exit for closing the program. Write a C++ program to create a function which take an integer as a argument and raise an exception integer found if the value of argument is > 0. Dinesh Kumar Bhawnani. Department.00 and less than or equal to Rs15000 then HRA=20% and DA=61% of the basic salary. DA. Mr. Post held. 44. Write a C++ program to find the maximum between two integers. Post held. Gross Salary) • Displaying all information about all the employees. Write a Program for invoking for that Generate & Handle exception. Write a C++ program to define a swap function template for swapping two objects of the same type. HR and Finance. HRA. 45. Basic salary. if parameter is < 0 then throws float type exception but for all design use only one catch block. 43. Basic salary. 46. 47. is parameter is = 0. Write an OOP program using a class template to read any five parameterized data type such as float and integer. Using a Menu do the following activities: • Filling up the database. Exception handling & Templates 42. • Searching for any employee.00 then HRA=10% and DA=90% of the basic salary. • Sale of the day. 41. ID number. Department. Text-Menu and File I/O operations.raise an exception float if the value of argument is < 0. • If Basic salary greater than Rs15000 then HRA=30% and DA=72% of the basic salary. raise an exception character found if value of argument is = 0. corresponding prices and Grand total. 50. DA. Gross salary according to the following conditions: • If Basic less than Rs5000. then throw character type. Create a database of 10 employees in a firm containing three departments – EDP.Object Oriented Programming Using C++ • Purchase option for purchasing any item depending upon the selected item serial number. and print the average. • Exit the program. BITD. • Displaying all information related to any selected employee (Name. 49. Implement the above program using Structures. 48. Write a C++ program to read two numbers and find the division of these two numbers using exception handling. The database should contain Employee name. HRA. containing Item units. two floats and two doubles using templates. Write a C++ to create a function which take a parameter is the value of parameter is > 0 then throw integer type.

Sign up to vote on this title
UsefulNot useful