OOPs with C++

Teacher

Sujata Acharya

Category

Core Courses

Course Attendees

Still no participant

Course Reviews

Still no reviews

Course Name : OOPs with C++

Code(Credit) : CUTM1879(3-2-1)

Course Objectives

  • The course is designed for providing knowledge of C / C++. Students will be able to develop logics which will help them to create programs, applications.
  • Learn problem solving using object-oriented concepts
  • Implement object oriented programming using C++
  • Realize advantages of object oriented programming over structured programming

Learning Outcomes

  • After the completion of this course, the students will be able to develop applications in C/C++.
  • Able to use object oriented concept to solve problems
  • Write an error free program o.f minimum 200 lines of code

Course Syllabus

Module 1
Introduction to C/C++

 

History of C and C++, Overview of Procedural Programming and Object-Orientation programming Using main() function, Compiling and Executing Simple Programs in C++, Data Types, Variables, Constants, Operators and Basic I/O: (Declaring, Defining and Initializing Variables, Scope of Variables, Using Named Constants, Keywords, Data Types, Casting of Data Types, Operators (Arithmetic, Logical and Bitwise), Using Comments in programs, Character I/O (getc, getchar, putc, putcharetc), Formatted and Console I/O (printf(), scanf(), cin, cout).

 

Assignment (1) : Describe all the datatypes briefly? What is operator? what are its type? Explain.

Practice (1) : Demonstrate all the datatype of C/C++ programming by taking variables?

 

Module 2
Expressions, Conditional Statements and Iterative Statements

 

Simple Expressions in C++ (including Unary Operator Expressions, Binary Operator Expressions), Understanding Operators Precedence in Expressions, Conditional Statements (if construct, switch-case construct), Understanding syntax and utility of Iterative Statements (while, do-while, and for loops), Use of break and continue in Loops, Using Nested Statements (Conditional as well as Iterative.

 

Assignment (2): Explain selection statement and sequential statement ?

Practice (2) : Write a program to compute the sum of the first n terms of the following series S = 1+1/2+1/3+1/4+......

Write a program to print the sum and product of digits of an integer.

Write a program to print reverse of a number.

 

Module 3
Functions and Arrays

 

Utility of functions, Call by Value, Call by Reference, Functions returning value, Void functions, Inline Functions, Return data type of functions, Functions parameters, Differentiating between Declaration and Definition of Functions, Command Line Arguments/Parameters in Functions, Functions with variable number of Arguments, Declaring and Defining an Array, Initializing an Array, Accessing individual elements in an Array, Manipulating array elements using loops, Use Various types of arrays (integer, float and character arrays / Strings), Two-dimensional Arrays (Declaring, Defining and Initializing Two Dimensional Array, Working with Rows and Columns).
Introduction to Multi-dimensional arrays.

 

Assignment ( 3): Describe call by value & call by reference.

Assignment ( 4): What is unction what are its type explain briefly.

Assignment (5): What is array ? what are its different type explain?

Practice (3): Write a function that checks whether a given string is Palindrome or not. Use this function to find whether the string entered by user is Palindrome or not.

Write a function to find whether a given no. is prime or not. Use the same to generate the prime numbers less than 100.

Write a program to compute the factors of a given number.

Write a macro that swaps two numbers.

Practice (4): Write a program to print a triangle of stars as follows (take number of lines from user):
*
***
*****
*******
*********
Write a program that prints a table indicating the number of occurrences of each alphabet in the text entered as command line arguments.

Practice (5): Write a program to perform following actions on an array entered by the user:
i) Print the even-valued elements
ii) Print the odd-valued elements
iii) Calculate and print the sum and average of the elements of array
iv) Print the maximum and minimum element of array
v) Print the array in reverse order

Practice (6): Create Matrix class using templates. Write a menu-driven program to perform following Matrix operations (2-D array implementation):
a) Sum b) Difference c) Product d) Transpose.

 

Module 4
Derived Data Types (Structures and Unions)

 

Understanding utility of structures and unions, Declaring, initializing and using simple structures and unions, Manipulating individual members of structures and unions, Array of Structures, Individual data members as structures, Passing and returning structures from functions, Structure with union as members, Union with structures as members.

 

Assignment (6): Describe structure, union & enum.

Practice (7): Create a structure Student containing fields for Roll No., Name, Class, Year and Total Marks. Create 10 students and store them in a file.

Write a program to retrieve the student information from file created in previous question and print it in following format: Roll No. Name Marks.

 

Module 5
Pointers and References in C++ & Memory Allocation in C++

 

Understanding a Pointer Variable, Simple use of Pointers (Declaring and Defining Pointers to simple variable), Pointers to Pointers, Pointers to structures, Problems with Pointers, Passing pointers as function arguments, Returning a pointer from a function, using arrays as pointers, Passing arrays to functions, References, Declaring and initializing references, Using references as function arguments and function return values, Memory Allocation in C++: (Differentiating between static and dynamic memory allocation, Use of malloc, calloc and free functions, Use of new and delete operators, storage of variables in static and dynamic memory allocation).

 

Assignment (7): what is pointer ? Explain its usage?

Assignment (8): What is memory allocation ? Differentiate between static and dynamic memory allocation?

Practice (8): Write a program that swaps two numbers using pointers.

Practice (9): Write a program to find sum of n elements entered by the user. To write this program, allocate memory dynamically using malloc() / calloc() functions or new operator.

 

Module 6
File I/O, Preprocessor Directives: Using Classes in C++

Opening and closing a file (use of fstream header file, ifstream, ofstream and fstream classes), Reading and writing Text Files, Using put(), get(), read() and write() functions, Random access in files, Understanding the Preprocessor Directives (#include, #define, #error, #if, #else, #elif, #endif, #ifdef, #ifndef and #undef), Macros Principles of Object-Oriented Programming, Defining & Using Classes, Class Constructors, Constructor Overloading, Function overloading in classes, Class Variables &Functions, Objects as parameters, Specifying the Protected and Private Access, Copy Constructors.
Overview of Template classes and their use.

 

Assignment (9): Explain the concept of file stream?
Explain constructor with its different types?
Differentiate between operator overloading and constructor overloading?

Practice (10):Create a class Triangle. Include overloaded functions for calculating area. Overload assignment operator and equality operator.

 

Module 7
Overview of Function Overloading and Operator Overloading

Overloading Operators (including assignment operators, unary operators, Introduction to Inheritance, Multi-Level Inheritance, Multiple Inheritance.
Polymorphism (Virtual Functions, Pure Virtual Functions), Basics Exceptional Handling (using catch and throw, multiple catch statements), Catching all exceptions, Restricting exceptions, Re-throwing exceptions.

 

Assignment (10): Explain inheritance?

Assignment (11): Describe Polymorphism?

Assignment (12): Define exception handling briefly?

Practice (11): Create a class Box containing length, breath and height. Include following methods in it:
a) Calculate surface Area
b) Calculate Volume
c) Increment, Overload ++ operator (both prefix & postfix)
d) Decrement, Overload -- operator (both prefix & postfix)
e) Check if it is a Cube or cuboid
Write a program which takes input from the user for length, breath and height to test the above class.

Practice 12:  Write a program to display Fibonacci series using recursion
Write a program to calculate Factorial of a number
Write a program to calculate GCD of two numbers.

 

Reference Books
1. HerbtzSchildt, "C++: The Complete Reference", Fourth Edition, McGraw Hill.2003
2. BjarneStroustrup, "The C++ Programming Language", 4th Edition, Addison-Wesley , 2013.
3. BjarneStroustroup, "Programming -- Principles and Practice using C++", 2nd Edition,
Addison-Wesley 2014.
4. E Balaguruswamy, "Object Oriented Programming with C++", Tata McGraw-Hill Education,
2008.
5. Paul Deitel, Harvey Deitel, "C++ How to Program", 8th Edition, Prentice Hall, 2011. 5.
John R. Hubbard, "Programming with C++", Schaum's Series, 2nd Edition, 2000.
6. Andrew Koeni, Barbara, E. Moo, "Accelerated C++", Published by Addison-Wesley , 2000. 7.
Scott Meyers, "Effective C++", 3rd Edition, Published by Addison-Wesley, 2005.
8. Harry, H. Chaudhary, "Head First C++ Programming: The Definitive Beginner's Guide", First
Create space Inc, O-D Publishing, LLC USA.2014
9. Walter Savitch, "Problem Solving with C++", Pearson Education, 2007.

Session Plan

Session 1

History of C and C++, Overview of Procedural Programming and Object-Orientation programming Using main() function, Compiling and Executing Simple Programs inC++.

https://www.youtube.com/watch?v=8taT1L57-wg

https://www.coursera.org/programs/centurion-university-on-coursera-8mese/browse?

Session 2

Data Types, Variables, Constants, Operators and Basic I/O: (Declaring, Defining and Initializing Variables, Scope of Variables, Using Named Constants, Keywords.

https://www.youtube.com/watch?v=rFnWoTnoC50&list=PLVlQHNRLflP8IGz6OXwlV_lgHgc72aXlh&index=4

https://www.coursera.org/learn/programming-fundamentals/supplement/t2McG/basic-data-types

Session 5

Using Comments in programs, Character I/O (getc, getchar, putc, putcharetc), Formatted and Console I/O (printf(), scanf(), cin, cout), Using Basic Header Files (stdio.h, iostream.h, conio.h etc).

https://www.youtube.com/watch?v=F8ci5HBa3C8

https://www.youtube.com/watch?v=rjL80QXfzi4

https://www.youtube.com/watch?v=DSasNSuF8Ak

Session 7 (Practice 1) (2 hrs)

Demonstrate all the datatype of C/C++ programming by taking variables?

https://www.youtube.com/watch?v=8GJqjFoY7UQ

Session 8

Simple Expressions in C++ (including Unary Operator Expressions, Binary Operator Expressions), Understanding Operators Precedence in Expressions.

https://www.youtube.com/watch?v=Nspq8J8zoBc

Session 12 (Assignment 2) (1 hr)

Explain selection statement and sequential statement ?

https://www.youtube.com/watch?v=Y8cR0P5S21M

Session 13 (Practice 2) (2 hrs)

Write a program to compute the sum of the first n terms of the following series S = 1+1/2+1/3+1/4+......
Write a program to print the sum and product of digits of an integer.
Write a program to reverse a number.

https://www.youtube.com/watch?v=YEiDCcVagHY

https://www.youtube.com/watch?v=_EG2-i7ZNd0

https://www.youtube.com/watch?v=lClEW-QePeU

Session 15

Functions returning value, Void functions, Inline Functions, Return data type of functions, Functions parameters, Differentiating between Declaration and Definition of Functions.

https://www.youtube.com/watch?v=fjHz9GPr6qM

https://www.youtube.com/watch?v=uVi-wyuC-Fg

Session 16

Command Line Arguments/Parameters in Functions, Functions with variable number of Arguments.

https://www.youtube.com/watch?v=jM7S1vR_4Pc

Session 17

Declaring and Defining an Array, Initializing an Array, Accessing individual elements in an Array, Manipulating array elements using loops, Use Various types of arrays (integer, float and character arrays / Strings).

https://www.coursera.org/programs/centurion-university-on-coursera-8mese/browse?allLanguages=English&index=prod_enterprise_products&productId=IpUTjfnpEealaBJvc-7qqA&productType=course&query=arithmetic+operators+in+C&showMiniModal=true&skills=C+Programming

https://www.youtube.com/watch?v=47JBVxCWXJA

Session 18

Session 19 (Assignment 3) (1 hr)

Describe call by value & call by reference.

https://www.youtube.com/watch?v=Xs22zOBfaoM

Session 20 (Assignment 4) (1 hr)

What is function what are its type explain briefly.

https://www.youtube.com/watch?v=TxWKGhF9KdM

Session 21 (Assignment 5) (1 hr)

What is array ? what are its different type explain?

https://www.youtube.com/watch?v=SPuS9UJF1lo&t=27s

Session 22 (Practice 3) (2 hrs)

Write a function that checks whether a given string is Palindrome or not. Use this function to find whether the string entered by user is Palindrome or not.
Write a function to find whether a given no. is prime or not. Use the same to generate the prime numbers less than 100.
Write a program to compute the factors of a given number.
Write a macro that swaps two numbers.

https://www.youtube.com/watch?v=LT5PDQvd_dA&t=170s

https://www.youtube.com/watch?v=SKh_sXkPvVE

https://www.youtube.com/watch?v=MgJ0FfWIlr8&t=281s

https://www.youtube.com/watch?v=Oo4A0K4t7iA

Session 23 (Practice 4) (2 hrs)

Write a program to print a triangle of stars as follows (take number of lines from user):
*
***
*****
*******
*********
Write a program that prints a table indicating the number of occurrences of each alphabet in the text entered as command line arguments.

https://www.youtube.com/watch?v=_64p6mahlV4

https://keviv03.blogspot.com/2012/04/occurrences-of-each-letter-of-alphabet_29.html

Session 24 (Practice 5) (2 hrs)

Write a program to perform following actions on an array entered by the user:
i) Print the even-valued elements
ii) Print the odd-valued elements
iii) Calculate and print the sum and average of the elements of array
iv) Print the maximum and minimum element of array
v) Print the array in reverse order

https://www.youtube.com/watch?v=TsN9wj_Qz60

https://www.youtube.com/watch?v=J8h7en22dxw

https://www.youtube.com/watch?v=SVhEFWPNwMg

https://www.youtube.com/watch?v=-IG93djxyb0

https://www.youtube.com/watch?v=8wive3M3D_g

Session 25 (Practice 6) (2 hrs)

Create Matrix class using templates. Write a menu-driven program to perform following Matrix operations (2-D array implementation):
a) Sum b) Difference c) Product d) Transpose.

https://www.youtube.com/watch?v=URB38hzV_DY

https://www.youtube.com/watch?v=xyXxVZNgEoU

https://www.youtube.com/watch?v=q2FpkqnTPjI

Session 26

Understanding utility of structures and unions, Declaring, initializing and using simple structures and unions.

https://www.youtube.com/watch?v=A4-b3pbAruI

Session 27

Manipulating individual members of structures and unions, Array of Structures, Individual data members as structures.

https://www.youtube.com/watch?v=gSYFHluoeHs

https://www.youtube.com/watch?v=2PjtV9-QyOE

Session 28

Passing and returning structures from functions, Structure with union as members, Union with structures as members.

https://www.youtube.com/watch?v=oBp22Jiv4kw

https://www.youtube.com/watch?v=A6p_8e6_03c

https://www.youtube.com/watch?v=KL65a0TyeYo

https://www.youtube.com/watch?v=U1SMcGr5Qek

Session 29 (Assignment 6) (1 hr)

Describe structure, union & enum.

Session 30 (Practice 7) (2 hrs)

Create a structure Student containing fields for Roll No., Name, Class, Year and Total Marks. Create 10 students and store them in a file.

Write a program to retrieve the student information from file created in previous question and print it in following format:
Roll No. Name Marks

https://www.youtube.com/watch?v=6Hls0SZ95AI

https://www.youtube.com/watch?v=7UxKNLWQSbU

Session 31

Understanding a Pointer Variable, Simple use of Pointers (Declaring and Defining Pointers to simple variable).

https://www.youtube.com/watch?v=nYIGtc1z7Tc

Session 32

Pointers to Pointers, Pointers to structures, Problems with Pointers, Passing pointers as function arguments.

Session 34

References, Declaring and initializing references, Using references as function arguments and function return values.

https://www.youtube.com/watch?v=BRsv3ZXoHto

https://www.youtube.com/watch?v=HEiPxjVR8CU

Session 35

Memory Allocation in C++: (Differentiating between static and dynamic memory allocation, Use of malloc, calloc and free functions.

https://www.youtube.com/watch?v=v49bwqQ4ouM&list=PLVlQHNRLflP8IGz6OXwlV_lgHgc72aXlh&index=50

https://www.youtube.com/watch?v=pTXvkLlAm38&list=PLVlQHNRLflP8IGz6OXwlV_lgHgc72aXlh&index=53

Session 36

Use of new and delete operators, storage of variables in (static and dynamic memory allocation).

https://www.youtube.com/watch?v=0duhNmu8zgA

Session 37 (Assignment 7) (1 hr)

what is pointer ? Explain its usage?

Session 38 (Assignment 8) (1 hr)

What is memory allocation ? Differentiate between static and dynamic memory allocation?

Session 39 (Practice 8) (2 hrs)

Write a program that swaps two numbers using pointers.

https://www.youtube.com/watch?v=Ukk0HQFFHcY&t=91s

Session 40 (Practice 9) (2 hrs)

Write a program to find sum of n elements entered by the user. To write this program, allocate memory dynamically using malloc() / calloc() functions or new operator.

https://www.youtube.com/watch?v=17k1Av6Srdg

Session 41

Opening and closing a file (use of fstream header file, ifstream, ofstream and fstream classes), Reading and writing Text Files, Using put(), get(), read() and write() functions.

https://www.youtube.com/watch?v=6BhH2FPfS30

https://www.youtube.com/watch?v=4l8YQQcz_m0

Session 42

Random access in files, Understanding the Preprocessor Directives (#include, #define, #error, #if, #else, #elif, #endif, #ifdef, #ifndef and #undef), Macros Principles of Object-Oriented Programming.

https://www.youtube.com/watch?v=4SGQ9LOTfvA

https://www.youtube.com/watch?v=V-uIlFcTGdg&list=PLVlQHNRLflP8_DGKcMoRw-TYJJALgGu4J&index=36

Session 43

Defining & Using Classes, Class Variables & Functions, Function overloading in classes.

https://www.youtube.com/watch?v=MoW42XKof0Q&list=PLWPirh4EWFpGDG3--IKMLPoYrgfuhaz_t&index=32

Session 45

Objects as parameters, Specifying the Protected and Private Access, Overview of Template classes and their use.

https://www.youtube.com/watch?v=gsYe3mWCOi4

Session 46 (Assignment 9) (1 hr)

Explain the concept of file stream?
Explain constructor with its different types?
Differentiate between operator overloading and constructor overloading?

Session 47 (Practice 10) (2 hrs)

Create a class Triangle. Include overloaded functions for calculating area. Overload assignment operator and equality operator.

https://www.youtube.com/watch?v=84q3MCeqMMI

Session 52 (Assignment 10) (1 hr)

Explain inheritance?

Session 53 (Assignment 11) (2 hr)

Describe Polymorphism?

Define exception handling briefly?

Session 54 (Practice 11) (2 hrs)

Create a class Box containing length, breath and height. Include following methods in it:
a) Calculate surface Area
b) Calculate Volume
c) Check if it is a Cube or cuboid

https://www.youtube.com/watch?v=-ZcXIWUmj2s

https://www.youtube.com/watch?v=2r0dbBx9ync

Session 55 (Practice 12) (2 hrs)

WAP to display Fibonacci series using recursion
WAP to calculate Factorial of a number (i)using recursion, (ii) using iteration
WAP to calculate GCD of two numbers.

https://www.youtube.com/watch?v=JoqHccxeMj0

https://www.youtube.com/watch?v=rj8FG_AKpOY

https://www.youtube.com/watch?v=VRo2Iyzv_aY

Case Studies

Our Main Teachers

Sujata Acharya

Assistant Professor, Department of IT, SoAS, Balangir
VIEW PROFILE