Paper 16: Computer Programming (C++ Theory) : SCAA Dated: 09.05.2019
Paper 16: Computer Programming (C++ Theory) : SCAA Dated: 09.05.2019
Paper 16: Computer Programming (C++ Theory) : SCAA Dated: 09.05.2019
UNIT II:
Functions in C++: Introduction The Main Function Function Prototyping Call
by Reference Return by Reference Inline Functions Default Arguments const
Arguments Recursion Function Over Loading Friend and Virtual Functions Math
Library Functions.
UNIT III:
Classes and Objects: Introduction C Structures Revisited Specifying a Class
Defining Member Functions A C++ Program with Class Making An Outside Function
Inline Nesting Of Member Functions Private Member Functions Arrays Within A Class
Memory Allocation for Objects Static Data Members Static Member Functions
Arrays of Objects Objects as Function Arguments Friendly Functions Returning
Objects const Member Functions.
UNIT IV:
Operator Overloading: Introduction Defining Operator Overloading
Overloading Unary Operators Overloading Binary Operators Overloading Binary
Operators Using Friends Manipulating of Strings Using Operators Some Other Operator
Overloading Examples Rules for Overloading Operators.
UNIT-V:
Working with Files: Introduction Classes for File Stream Operations - Opening
and Closing a File Detecting End-of-File More about open( ): File Modes File Pointers
and their Manipulations Sequential Input and Output Operations Updating a File:
Random Access Error Handling During File Operations.
Text Book:
Object Oriented Programming with C++ by E. Balaguruswamy, Tata McGraw-Hill
Publishing Company Limited, Sixth Edition.
Unit I : 1.4 1.6 and 3.1 3.25
Unit II : 4.1 4.12 and 10.1 10.6
Unit III : 5.1 5.17, 6.1 6.7 and 6.10 6.11
Unit IV : 7.1 7.8 and 8.1 8.12
Unit V : 11.1 11.9
PRACTICAL - COMPUTER PROGRAMMING (C++ PRACTICAL)
1. friend FUNCTION usage: Create two classes to store the value of distances in meters-
centimetres and feet-inches. Write a program that can create the values of the class objects
and add one object with another. Use a friend function to carry out addition operation. The
result may be stored in any object depending on the units in which results are required. The
display should be in the order of meters & centimetre and feet & inches depending on the
order of display.
2. OVERLOADING OBJECTS: Create a class that contains one float data member.
Overload all the four arithmetic operators so that operate on the objects of the class.
3. OVERLOADING CONVERSIONS: Design a class Polar which describes a point in a
plane using polar co-ordinates radius and angle. Use the overloaded + operator to add two
objects of Polar. Note that we cannot add polar values of two points directly. This requires
first the conversion of points into rectangular co-ordinates and finally converting the result
into polar co-ordinates. You need to use following trigonometric formulae: = r * cos (a);
= r * sin (a);= ; = + .
4. OVERLOADING VECTOR: Define a class for Vector containing scalar values. Apply
overloading concepts for Vector Addition, Multiplication of a Vector by a scalar quantity,
replace the values in a Position Vector.
5. OVRELOADING MATRIX:
Create a class MAT of size m * n. Define all possible matrix operations for MAT type
objects. Verify the identity: (A-B) 2 = A2+B2 2AB.
6. INHERITANCE: Create three classes: alpha, beta and gamma, each containing one data
member. The class gamma should be inherited from both alpha and beta. Use a constructor
function in the class gamma to assign values to the data members of all the classes. Write a
program to print the value of data members of all the three classes.
7. FILE HANDLING: Write a program to create a disk file containing the list of names and
telephone numbers in two columns, using a class object to store each set of data. Design an
interactive menu to access the file created and to implement the following tasks:
(a) Determine the telephone number of the specified person.
(b) Determine the name if a telephone number is known.
(c) Update the telephone number, whenever there is a change.