Introduction to C++ Programming
CADCIM Technologies
St. Andrews Drive
Schererville, IN 46375
USA
(www.cadcim.com)
Contributing Author
Sham Tickoo
Professor
Purdue University Calumet
Hammond, Indiana
USA
Introduction to C++ Programming
Sham Tickoo
CADCIM Technologies
St Andrews Drive
Schererville, Indiana 46375, USA
www.cadcim.com
Copyright 2016 by CADCIM Technologies, USA. All rights reserved. Printed in the United States of America except as permitted under the United States Copyright Act of 1976.
No part of this publication may be reproduced or distributed in any form or by any means, or stored in the database or retrieval system without the prior permission of CADCIM Technologies.
ISBN 978-1-942689-38-6
NOTICE TO THE READER
Publisher does not warrant or guarantee any of the products described in the text or perform any independent analysis in connection with any of the product information contained in the text. Publisher does not assume, and expressly disclaims, any obligation to obtain and include information other than that provided to it by the manufacturer.
The reader is expressly warned to consider and adopt all safety precautions that might be indicated by the activities herein and to avoid all potential hazards. By following the instructions contained herein, the reader willingly assumes all risks in connection with such instructions.
The Publisher makes no representation or warranties of any kind, including but not limited to, the warranties of fitness for particular purpose or merchantability, nor are any such representations implied with respect to the material set forth herein, and the publisher takes no responsibility with respect to such material. The publisher shall not be liable for any special, consequential, or exemplary damages resulting, in whole or part, from the readers use of, or reliance upon, this material.
www.cadcim.com
CADCIM Technologies
DEDICATION
To teachers, who make it possible to disseminate knowledge
to enlighten the young and curious minds
of our future generations
To students, who are dedicated to learning new technologies
and making the world a better place to live
THANKS
To employees of CADCIM Technologies for their valuable help
Online Training Program Offered by CADCIM
Technologies
CADCIM Technologies provides effective and affordable virtual online training on various software packages including Computer Aided Design and Manufacturing and Engineering (CAD/CAM/CAE), computer programming languages, architecture, and GIS. The training is delivered live via Internet at any time, any place, and at any pace to individuals as well as the students of colleges, universities, and CAD/CAM training centers. The main features of this program are:
Training for Students and Companies in a Classroom Setting
Highly experienced instructors and qualified at CADCIM Technologies conduct the classes under the guidance of Prof. Sham Tickoo of Purdue University Calumet, USA. This team has authored several textbooks that are rated one of the best in their categories and are used in various universities, and training centers in North America, Europe, and in other parts of the world.
Training for Individuals
CADCIM Technologies with its cost effective and time saving initiative strives to deliver the training in the comfort of your home or work place, thereby relieving you from the hassles of traveling to training centers.
Training Offered on Software Packages
CADCIM provides basic and advanced training on the following software packages:
CATIA, Pro/ENGINEER Wildfire, PTC Creo Parametric, Creo Direct, Autodesk Solid Edge, NX, AutoCAD, AutoCAD LT, AutoCAD Plant 3D, Customizing and ANSYS
Architecture and Autodesk Revit AutoCAD Civil 3D, Autodesk Revit Structure, AutoCAD Map Revit MEP, Navisworks, Primavera, and Bentley STAAD Pro
Animation and Autodesk 3ds Max, Autodesk 3ds Max Design, Autodesk Maya, Autodesk Alias, The Foundry NukeX, MAXON CINEMA 4D, Adobe Flash, and Adobe Premiere
Computer C++, VB.NET, Oracle, AJAX, and Java
For more information, please visit the link: http://www.cadcim.com
Note
If you are a faculty member, you can register by clicking on the following link to access the teaching resources: The student resources are available at We also provide Live Virtual Online Training on various software packages. For more write us at
Table of Contents
Chapter 1: Introduction to C++
Chapter 2: Getting Started with C++
Chapter 3: Control Statements
Chapter 4: Functions and Arrays
Chapter 5: Strings, Pointers, and Structures
Chapter 6: Union, Enumeration, and Preprocessor
Chapter 7: Data Structure
Chapter 8: Classes and Objects
Chapter 9: Constructors, Destructors, and Operator Overloading
Chapter 10: Inheritance
Chapter 11: Virtual Functions and Polymorphism
Chapter 12: The C++ Console I/O Operations
Chapter 13: Exception Handling
Chapter 14: The File I/O System
Preface
C++
Welcome to Introduction to C++ an example based textbook, written to cater to the needs of beginners and intermediate users. C++ is an object-oriented programming language, which is a preferred programming approach followed by the software industry. C++ enjoys the distinction of being the most popular and widely used OOP language in the world. The syntax, style, features and philosophy of the language form the basis of many other programming languages such as Java and C#.
Created by Bjarne Stroustrup in the early 1980s, C++, over the period, has undergone many changes and improvements. In 1998, the language was standardized by the American National Standards Institute (ANSI) and the International Standards Organization (ISO). The textbook confirms to these standards and explains various features of the language in a simple and easy style.
The highlight of the textbook is that each concept introduced in it has been exemplified by a program to clarify and facilitate better understanding. Also, the line-by-line explanation of each program ensures that the users with no previous programming experience are able to understand the concepts and master the programming techniques and use them with flexibility while designing programs.
The main features of the book are as follows:
Programming This textbook introduces the key ideas of object-oriented programming in an intuitive way. The concepts are illustrated through best programming examples, covering all aspects of OOP and C++.
Additional information is provided to the users in the form of notes.
Illustrations: There is an extensive use of examples, schematic representation, flow-charts, tables, screen capture images, and programming exercises.
Learning The first page of every chapter summarizes the topics that are covered in it.