C++ Guidelines and Practical List
Course Objective: This course is designed to develop structured as well as object-oriented programming skills using C++ programming language. The course not only focuses on basic C++ constructs but also covers object-oriented programming features in-depth, namely Encapsulation, Abstraction, Inheritance and Polymorphism for writing efficient codes.
Introduction to C++: Overview of Procedural Programming and Object-Oriented Programming, Using main () function, Header Files, Compiling and Executing Simple Programs in C++.
Programming Fundamentals: Data types, Variables, Operators, Expressions, Arrays, Keywords, Naming Convention, Decision making constructs (if, switch), Looping (for, while, do…while), Type Casting, Input-output statements, Functions, Command Line Arguments/Parameters.
Object Oriented Programming: Overview of Abstraction, Encapsulation, Inheritance, and Polymorphism. Creating Classes and objects, Modifiers and Access Control, Constructors, Implementation of Inheritance (Single and multilevel), Implementation of Polymorphism (Function Overloading and Operator Overloading, Function Overriding).
Pointers and References: Static and dynamic memory allocation, Pointer and Reference Variables, Pointers vs. References, Implementing Runtime polymorphism using pointers and references.
Exception and File Handling: Using try, catch, throw, throws and finally; Nested try, creating user defined exceptions, File I/O Basics, File Operations.
C++ Reference Books:
- Forouzan & Gilbert (2012). Computer Science: A Structured Approach Using C++.
- Schildt, H. (2003). C++: The Complete Reference. 4th edition. Tata McGraw-Hill.
C++ Practicals List
- Write a program to compute the sum of the first n terms of the following series:S = 1 – 1 / (2 ^ 2) + 1 / (3 ^ 3) – … 1 / (n ^ n)where ^ is exponentiation.The number of terms n is to be taken from user through command line. If command lineargument is not found then prompt the user to enter the value of n.
- Write a program to remove the duplicates from an array.
- Write a program that prints a table indicating the number of occurrences of each alphabet in the text entered as command line arguments.
- Write a menu driven program to perform following operations on strings (without using inbuilt string functions):
- Show address of each character in string
- Concatenate two strings.
- Compare two strings
- Calculate length of the string (use pointers)
- Convert all lowercase characters to uppercase
- Reverse the string
- Write a program to merge two ordered arrays to get a single ordered array.
- Write a program to search a given element in a set of N numbers using Binary search(i) with recursion (ii) without recursion.
- Write a program to calculate GCD of two numbers (i) with recursion (ii) without recursion.
- Create Matrix class. Write a menu-driven program to perform following Matrix operations:
- Define a class Person having name as a data member. Inherit two classes Student and Employee from Person. Student has additional attributes as course, marks and year and Employee has department and salary. Write display() method in all the three classes to display the corresponding attributes. Provide the necessary methods to show runtime polymorphism.
- Create a class Triangle. Include overloaded functions for calculating area. Overload assignment operator and equality operator.
- Write a program to read two numbers p and q. If q is 0 then throw an exception else display the result of p/q.
- Rewrite Matrix class of Q8 with exception handling. Exceptions should be thrown by the functions if matrices passed to them are incompatible and handled by main() function.
- Create a class Student containing fields for Roll No., Name, Class, Year and Total Marks. Write a program to store 5 objects of Student class in a file. Retrieve these records from file and display them.
- Copy the contents of one text file to another file, after removing all whitespaces.