oops index page 2014
DESCRIPTION
oops index page,oops lab manualTRANSCRIPT
![Page 1: OOPS Index Page 2014](https://reader036.vdocument.in/reader036/viewer/2022081908/55cf9883550346d03398170c/html5/thumbnails/1.jpg)
Department of Computer Science & Engineering
Bhilai Institute of Technology, Durg
OOPS Using C++ Lab
Session : 2013 – 2014
Index
Name of the Student : SN Program Date
Performed
Date
Submitted
Remarks
1 Write a C++ program, which reads a five-digit number, and find the sum of its digits.
2 Write a C++ program, which reads a five-digit number, and reverse that number.
3 Write a C++ program, which reads a number, and find whether it is even or odd.
4 Write a C++ program, which reads a number, and find whether it is prime or not.
5 Write a C++ program, which reads a year and find whether the entered year is leap or
not.
6 Write a C++ program, which reads a number, and find the prime numbers from 1 to that
number.
7 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
1 2
1 2 3
1 2 3 4
2) 1
2 3
4 5 6
7 8 9 10
3) 1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
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.
21 Write a C++ program to input the name of an employee along with their basic salary and
find his gross salary using structure. (DA = 70% of basic salary & HRA = 10% of basic
salary).
![Page 2: OOPS Index Page 2014](https://reader036.vdocument.in/reader036/viewer/2022081908/55cf9883550346d03398170c/html5/thumbnails/2.jpg)
22 Write a C++ program to perform the following arithmetic operations of a complex
number using a structure.
• Addition of two complex numbers.
• Subtraction of two complex numbers.
• Multiplication of two complex numbers.
• Division of two complex numbers.
23 Write a C++ program to find the sum of two numbers using command line arguments.
24 Write a C++ program that accept a number and find the factorial of that number using
command line arguments.
25 Write a C++ program that accept the name and basic salary of an employee and find
their gross salary using command line arguments. (For calculating the gross salary the
DA is 70% of basic salary and HRA is 10% of basic salary).
26 Write an OOP program, which reads two numbers calculate and print the smallest one.
27 Write an OOP program which reads two numbers and prints sum of these two numbers.
28 Write an OOP program which performs the following operations
• Addition of two matrices.
• Subtraction of two matrices.
• Multiplication of two matrices.
29 Write an OOP program which reads two complex numbers and perform the following
operations
• Addition
• Subtraction
• Multiplication
• Division
30 Write an OOP program to find the roots of a quadratic equation.
31 Write an OOP program to read the name of 10 employees along with their basic salary
and find their gross salary. (DA = 70% of basic salary and HRA = 10 % of basic salary).
32 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.
33 Write an OOP program to find the maximum of data members of two different class
using friend functions.
34 Write an OOP program to exchange the private data members of two different functions
using friend functions.
35 Write an OOP program to define a class to represent a bank account. Including the
following members.
Data members
• Name of the depositor
• Account number
• Type of account
• Balance amount in the account
Member Functions
• To assign initial values
• To deposit an amount.
• To withdraw an amount after checking the balance
• To display name and balance
36 Write an OOP program to define a class to represent a vector (a series of float values).
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, 20, 30…)
37 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. Note that
for storing account number use an array.
38 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. The employee
bio-data consist of following field
• Name
• Age
• Gender
• Designation
• Salary
![Page 3: OOPS Index Page 2014](https://reader036.vdocument.in/reader036/viewer/2022081908/55cf9883550346d03398170c/html5/thumbnails/3.jpg)
• Experience
39 Write an OOP program which prints the object number whenever we create an object.
40 Write an OOP program to count how many times a particular member function of a
class be called by
(a) A particular object (b) Any objects
41 Write an OOP program to define a constructor for a “Date” class that initializes the Date
objects with initial values. In case initial values are not provided, it should initialize the
objects with default values.
42 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
43 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
• 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
44 Write an OOP program, which reads a complex number, and copy that into another
using copy constructor.
45 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.
• Out of the class definitions using the scope resolution operator.
Also make this program with the help of the copy constructor.
46 Write an OOP program to overload unary – operator to change the sign of private data
member of a class.
47 Write an OOP program to concatenate two strings by overloading + operator using
(a) Member function (b) Friend Function
48 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.
49 Write an OOP program to overload = = operator to compare two strings.
50 Write an OOP program to perform simple arithmetic operations of two complex
numbers using operator overloading.
51 Write an OOP program to overload = operator to copy the contents of one string object
to another string object.
52 Write an OOP program to generate Fibonacci series by overloading
(a) Prefix operator (b) Postfix operator
53 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)
• 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.
![Page 4: OOPS Index Page 2014](https://reader036.vdocument.in/reader036/viewer/2022081908/55cf9883550346d03398170c/html5/thumbnails/4.jpg)
54 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.
55 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.
56 Write an OOP program to demonstrate how ambiguity can be avoided using scope
resolution operator in the following inheritance
(a) Single Inheritance (b) Multiple Inheritance
57 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.
58 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
59 Write a program to count the number of words in a given text file.
60 Write a program to store every character typed on the keyboard in to a file. When the
user presses the ESC key then the program should stop.
61 Write a program to Encrypt and Decrypt a text file. Using a text Menu.
62 Write a program to copy the contents of one text file to another and display both the
files. Using a text Menu.
63 Write a program to concatenate one file at the end of another and print both the files.
Using text menu.
64 Create a database of 10 students. The database should contain the Name, Marks of 5
![Page 5: OOPS Index Page 2014](https://reader036.vdocument.in/reader036/viewer/2022081908/55cf9883550346d03398170c/html5/thumbnails/5.jpg)
subjects, Aggregate Marks, Aggregate percentage and Division according to the
following conditions: -
• Percentage above or equal to 60 – First division.
• Percentage between 50 and 59 – Second division.
• Percentage between 40 and 49 – Third division.
• Percentage below 40 - Fail
Display the above database of every student in a tabulated form.
Implement the above program using Structures, Text-Menu and File I/O operations.
65 Create a database for a Shop containing 10 items. The First part of the database should
contain the Name of item, serial number of item, Unit price of item and Sale of the day.
The Second part of the database should contain the Customer name, Items purchased
and total purchase.
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.
• Filling up the second part of the database related to the customer information.
• List of Item names with item serial number and corresponding unit costs.
• Purchase option for purchasing any item depending upon the selected item serial
number.
• Sale of the day.
• Total Purchase done, containing Item units, corresponding prices and Grand total.
• Exit for closing the program.
Implement the above program using Structures, Text-Menu and File I/O operations.
66 Create a database of 10 employees in a firm containing three departments – EDP, HR
and Finance. The database should contain Employee name, Employee ID number,
Department, Post held, Basic salary, DA, HRA, Gross salary according to the following
conditions: -
• If Basic less than Rs5000.00 then HRA=10% and DA=90% of the basic salary.
• If Basic salary greater than Rs5000.00 and less than or equal to Rs15000 then
HRA=20% and DA=61% of the basic salary.
• If Basic salary greater than Rs15000 then HRA=30% and DA=72% of the basic salary.
Using a Menu do the following activities: -
• Filling up the database.
• Displaying all information related to any selected employee (Name, ID number,
Department, Post held, Basic salary, HRA, DA, Gross Salary)
• Displaying all information about all the employees.
• Searching for any employee.
• Exit the program.
Implement the above program using Structures, Text-Menu and File I/O operations.
67 Write a C++ program to find the maximum between two integers, two floats and two
doubles using templates.
68 Write a C++ program to define a swap function template for swapping two objects of the
same type.
69 Write a C++ program to read two numbers and find the division of these two numbers
using exception handling.
70 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, raise an exception character
found if value of argument is = 0,raise an exception float if the value of argument is < 0.
71 Write a C++ to create a function which take a parameter is the value of parameter is > 0
then throw integer type, is parameter is = 0, then throw character type, if parameter is < 0
then throws float type exception but for all design use only one catch block.
72 Write a Program to Bubble Sort using template function.
73 Write a Program for invoking for that Generate & Handle exception.
74 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.
75 Write an OOP program using a class template to read any five parameterized data type
such as float and integer, and print the average.
Overall Lab Attendance : ___ out of ___
Overall Grade :
Faculty I/C
(Dinesh Kumar Bhawnani)