0% found this document useful (0 votes)
58 views

24CS101

Uploaded by

23102208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

24CS101

Uploaded by

23102208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Course Code L T P C

PROGRAMMING IN C++
24CS101 (Theory Course with Laboratory Component) 3 0 3 4.5

OBJECTIVES:
The Course will enable learners to:
 To learn problem solving and programming fundamentals.
 To gain knowledge on pointers and functions.
 To apply the principles of object orientated programming.
 To understand operator overloading, inheritance and polymorphism.
 To use the functionalities of I/O operations, files build C++ programs usingexceptions.

UNIT I PROGRAMMING FUNDAMENTALS 9+9


Types of computer programming languages - Genesis of C++ - Program Life Cycle - Structure of
C++ program - Identifiers - Variables - Keywords - Number System -Binary Number System -Octal
Number System- Decimal Number System -Hexadecimal Number System - Data types - Constants
- Errors – Operators- Expressions - Type Conversions - Control-Flow Statements - Conditional
Statements - Iterative Statements -Unconditional Control Statements - Arrays - One-Dimensional
Arrays - Two-Dimensional Arrays - Multi -Dimensional Arrays - Strings - String Manipulation
Functions - Array of Strings.

List of Exercise/Experiments:

1. Write C++ programs for the following:


a. Find the sum of individual digits of a positive integer.
b. Compute the GCD of two numbers.
c. Find the roots of a number (Newton’s method)
2. Write C++ programs using arrays:
a. Find the maximum of an array of numbers.
b. Remove duplicates from an array of numbers.
c. Print the numbers in an array after removing even numbers.
3. Write C++ programs using strings:
a. Checking for palindrome.
b. Count the occurrences of each character in a given word.

UNIT II POINTERS AND FUNCTIONS 9+9

Pointers - Pointer Variables - Pointer Operators & Expressions -Pointers with Arrays - Functions -
Scope Rules -Function Arguments -return Statement - Function Variables - Storage Classes - Types
of storage classes - Create Header Files - User-Defined Functions - Inline Functions - Function
Overloading -Recursion - Namespaces.
List of Exercise/Experiments:

1. Generate salary slip of employees using structures and pointers. Create a structure Employee with
the following members: EID, Ename, Designation, DOB, DOJ, Basic pay Note that DOB and
DOJ should be implemented using structure within structure.

2. Compute internal marks of students for five different subjects using structures and functions.

UNIT III CLASSES AND OBJECTS 9+9

Concepts of Object Oriented Programming – Benefits of OOP – Simple C++ program –


Classes and Objects - Member functions - Nesting of member functions - Private member functions
- Memory Allocation for Objects - Static Data Members - Static Member functions - Array of Objects
- Objects as function arguments - Returning objects - friend functions – Const Member functions -
Constructors – Destructors.

List of Exercise/Experiments:

1. Write a program Illustrating Class Declarations, Definition, and Accessing ClassMembers.


2. Program to illustrate default constructor, parameterized constructor and copy constructors.

Practice Questions & Scenario Based Questions:

1. Imagine you are working as a software engineer at a tech company. Your team is developing a
mathematical software library that will be used in various applications across the company. One
of the features that your team lead has asked you to implement is a function that calculates the
number of trailing zeros in the factorial ofa number.

The team lead has emphasized the importance of encapsulation in your


implementation.

2. Create a C++ class Calculator representing a simple calculator. The class should have the
following attributes and methods:

Attributes: Two operands and an operation (+, -, *, /)


Methods: Perform the operation and return the result
Implement constructors to initialize the calculator with default values (0,0) and with
specified values. Also, implement a destructor to perform any necessary cleanup.

UNIT IV OPERATOR OVERLOADING, INHERITANCE AND POLYMORPHISM 9+9

Operator Overloading - Overloading Using Friend functions – Inheritance – Types of inheritance –


Virtual Base Class - Abstract Class – Constructors in Derived Classes - member class: nesting of
classes.
Pointer to objects – this pointer- Pointer to derived Class - Virtual functions – PureVirtual Functions
– Polymorphism.
List of Exercise/Experiments:

1. Write a Program to Demonstrate the i) Operator Overloading. ii) Function


Overloading.
2. Write a Program to Demonstrate Friend Function and Friend Class.
3. Program to demonstrate inline functions.
4. Program for Overriding of member functions.
5. Write C++ programs that illustrate how the following forms of inheritance aresupported:
Single inheritance b) Multiple inheritance c) Multi level inheritance d) Hierarchicalinheritance.
Practice Questions & Scenario Based Questions:

1. Joy is a software developer at a 3D modeling company. The company is developinga new


software tool that will be used by architects and engineers to design and analyze 3D models of
various structures. One of the features that her project manager has asked is to implement a
function that calculates the volume of basic 3Dshapes like cylinders and cuboids. The project
manager has emphasized the importance of using function overloading in her implementation..

2. Imagine you are a software developer tasked with creating a utility program for a school that
handles student scores. The school wants a simple program where teachers can enter the scores
of students for a particular test, and the program will then provide the highest and lowest scores
among them. This will help the teachers quickly identify the top performer and the student who
might need extra help.
Your task is to write program that satisfies the above scenario using inline function

3. Develop a software system to manage part-time worker students at a university. These students
have unique attributes such as their name, student ID, hourly wage, and hours worked per week.
Your goal is to create a C++ program that models this system.
4. Ramu is a software developer at a company specializing in developing softwaresolutions
for geometric shapes. Recently, a client approached with a request to create a program to
calculate the areas of rectangles and triangles.

UNIT V I/O, FILES AND EXCEPTIONS 9+9

C++ Streams – Unformatted I/O - Formatted Console I/O – Opening and Closing File – File modes -
File pointers and their manipulations – Templates – Class Templates – Function Templates -
Exception handling.

List of Exercise/Experiments:

1. Program to demonstrate pure virtual function implementation.


2. Count the number of account holders whose balance is less than the minimumbalance
using sequential access file.
3. Write a Program to Demonstrate the Catching of all Exceptions.
Practice Questions & Scenario Based Questions:

1. Develop a simple library management system. Create a base class Book representing a book in
the library. The class should have attributes such as title, author, and ISBN (International Standard
Book Number). Implement a virtual functiondisplayDetails() to display information about the
book.

2. A software developer working on a banking application. One of the requirements is toanalyze


account holders' balances based on a minimum balance threshold. The application should read
account information from a sequential access file, where each line represents an account record
in the format: account_holder_name, balance.

3. The financial company is developing a new software tool that will be used by financial analysts
to perform various calculations. One of the features of that projectis to implement is a function
that performs division of two numbers.

Write a program that takes two integer inputs, numerator and denominator, from the user.
Implement error handling to check if the denominator is zero. If the denominator is zero, display
the message "Division by zero is not allowed!" using an
exception. If the denominator is not zero, calculate the result of the division and display it.
4. Mini project.
TOTAL: 45+45 = 90 PERIODS

OUTCOMES:
Upon completion of the course, the students will be able to:
CO1: Solve problems using basic constructs in C++.
CO2: Implement C++ programs using pointers and functions.
CO3: Apply object-oriented concepts and solve real world problems.
CO4: Develop C++ programs using operator overloading and polymorphism.
CO5: Implement C++ programs using Files and exceptions.
CO6: Develop applications using C++ concepts

TEXT BOOKS:
1. Herbert Schildt, “The Complete Reference C++”, 4th edition, MH, 2015. (Unit 1 & 2)
2. E Balagurusamy,”Object Oriented Programming with C++”, 4th Edition, TataMcGraw-Hill
Education, 2008. (Unit 3, 4 & 5)

REFERENCES:
1. Karl Beecher,”Computational Thinking: A beginner's guide to problem-solving and
programming”, BCS Learning & Development Ltd, 2017. (Unit 1)
2. Nell Dale, Chip Weems, “Programming and Problem Solving with C++”, 5th Edition,Jones and
Barklett Publishers, 2010.
3. John Hubbard, “Schaum's Outline of Programming with C++”, MH, 2016.
4. Yashavant P. Kanetkar, “Let us C++”, BPB Publications, 2020
5. ISRD Group, “Introduction to Object-oriented Programming and C++”, Tata McGraw- Hill
Publishing Company Ltd., 2007.
6. D. S. Malik, “C++ Programming: From Problem Analysis to Program Design”, ThirdEdition,
Thomson Course Technology, 2007.
https://infyspringboard.onwingspan.com/web/en/app/toc/
lex_auth_01297200240671948837_shared/overview

LIST OF EQUIPMENTS:
1. Standalone desktops with C/C++ compiler (or) Server with C/C++ compiler.

You might also like