C++ Programming Language: Simple, Short, and Straightforward Way of Learning C++ Programming
4/5
()
Programming
C++ Programming
Software Installation
C++ Programming Language
C++
Variables
Arrays
Error Handling
C++ Classes
Software Development
About this ebook
This book is for absolute beginners with or without prior knowledge in programming, as this book uses Simple words, Short sentences, and Straightforward paragraphs. The triple S way of learning C++ programming. C++ (pronounced as cee plus plus) is a general-purpose programming language. The main object of C++ is to add object-orientation to its predecessor C language. C++ has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation. There are also other useful features added to C++ such as inheritance and polymorphism. The topics covered in this book includes brief introduction to C++ programming, variables, data types, control structures, functions, pointers, and file management of external files. This book starts its discussion from short history to installation of the needed software resource and a step by step screen shots of how to write C++ programming code, compile and execute C++ programs. It presents graphical representation of algorithms for simpler learning. This book is packed with working and running C++ program samples and after reading this book, the reader would be able to develop and create C++ language programs based particularly from problems given in computer science courses, hence, adopting to other programming language will be a lot easier. This book is your initial step in your programming career.
Sherwyn Allibang
Sherwyn Allibang has 10 years experience in the academe as college professor handling business and IT related subjects. Aside from his career as an academe, he is also a freelance software developer catering system development from project management to core programming. With the degree in Bachelor of Science in Information Technology, Master in Business Administration, Master in Information Technology, and Doctor in Business Administration, Sherwyn is a solutions-focused, team oriented IT Specialist, with broad-based experience and hands-on skill in the successful implementation of highly effective technical support strategies. A proven ability to successfully analyze an organization's critical support requirements, identifies deficiencies and potential opportunities, and develops innovative solutions for increasing reliability and improving productivity.
Read more from Sherwyn Allibang
Methods of Research: Simple, Short, And Straightforward Way Of Learning Methods Of Research Rating: 4 out of 5 stars4/5Assembly Programming:Simple, Short, And Straightforward Way Of Learning Assembly Language Rating: 5 out of 5 stars5/5
Related to C++ Programming Language
Related ebooks
Learn C++ Rating: 4 out of 5 stars4/5C Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5C Programming Language Essentials Rating: 4 out of 5 stars4/5C++ Programming Language Rating: 0 out of 5 stars0 ratingsProgramming Concepts in C++ Rating: 0 out of 5 stars0 ratingsC Programming For Dummies Rating: 0 out of 5 stars0 ratingsBeginning C++ Programming Rating: 3 out of 5 stars3/5C Programming for Beginners: Your Guide to Easily Learn C Programming In 7 Days Rating: 4 out of 5 stars4/5C Programming Concepts Rating: 0 out of 5 stars0 ratingsC in 30 Pages Rating: 5 out of 5 stars5/5Beginning C++ Game Programming Rating: 4 out of 5 stars4/5Advanced C Concepts and Programming: First Edition Rating: 3 out of 5 stars3/5Modern C++ Programming Cookbook Rating: 5 out of 5 stars5/5Computer Programming In C Language Rating: 4 out of 5 stars4/5Teach Yourself C++ Rating: 4 out of 5 stars4/5C All-in-One Desk Reference For Dummies Rating: 5 out of 5 stars5/5C Programming Language, A Step By Step Beginner's Guide To Learn C Programming In 7 Days. Rating: 4 out of 5 stars4/5C++: A Beginner's Guide, Second Edition Rating: 0 out of 5 stars0 ratingsC Programming: C Programming Language for beginners, teaching you how to learn to code in C fast! Rating: 0 out of 5 stars0 ratingsUpdate to Modern C++ Rating: 0 out of 5 stars0 ratingsLearn C Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsAssembly Language Coding in Color: ARM and NEON Rating: 0 out of 5 stars0 ratingsC++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsBeginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5C Programmin Language Rating: 0 out of 5 stars0 ratingsC language Programming: Simple, Short, and Straightforward Way of Learning C Programming Rating: 3 out of 5 stars3/5C Programming Language Rating: 4 out of 5 stars4/5C++ Functions and tutorial Rating: 0 out of 5 stars0 ratingsC++17 STL Cookbook Rating: 3 out of 5 stars3/5
Electrical Engineering & Electronics For You
Beginner's Guide to Reading Schematics, Fourth Edition Rating: 4 out of 5 stars4/5Electricity for Beginners Rating: 4 out of 5 stars4/5The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5Upcycled Technology: Clever Projects You Can Do With Your Discarded Tech (Tech gift) Rating: 5 out of 5 stars5/5Electrical Engineering Rating: 4 out of 5 stars4/5The Homeowner's DIY Guide to Electrical Wiring Rating: 5 out of 5 stars5/5How Do Electric Motors Work? Physics Books for Kids | Children's Physics Books Rating: 0 out of 5 stars0 ratingsCircuitbuilding Do-It-Yourself For Dummies Rating: 0 out of 5 stars0 ratingsElectrical Engineering | Step by Step Rating: 0 out of 5 stars0 ratingsTwo-Stroke Engine Repair and Maintenance Rating: 0 out of 5 stars0 ratingsDIY Drones for the Evil Genius: Design, Build, and Customize Your Own Drones Rating: 4 out of 5 stars4/5Journeyman Electrician Exam Prep Mastery 2025-2026 Rating: 0 out of 5 stars0 ratingsThe Electrician's Trade Demystified Rating: 0 out of 5 stars0 ratingsHacking Electronics: Learning Electronics with Arduino and Raspberry Pi, Second Edition Rating: 0 out of 5 stars0 ratingsRamblings of a Mad Scientist: 100 Ideas for a Stranger Tomorrow Rating: 0 out of 5 stars0 ratings2022 Adobe® Premiere Pro Guide For Filmmakers and YouTubers Rating: 5 out of 5 stars5/5Raspberry Pi Electronics Projects for the Evil Genius Rating: 3 out of 5 stars3/5Electric Circuits Essentials Rating: 5 out of 5 stars5/5Basic Electricity Rating: 4 out of 5 stars4/5The Off Grid Solar Power Bible For Beginners Rating: 0 out of 5 stars0 ratingsBasic Electronics: Book 2 Rating: 5 out of 5 stars5/5Electronic Circuits for the Evil Genius 2/E Rating: 0 out of 5 stars0 ratingsTHE Amateur Radio Dictionary: The Most Complete Glossary of Ham Radio Terms Ever Compiled Rating: 4 out of 5 stars4/5100 Circuits - Audio 1 Rating: 0 out of 5 stars0 ratingsAutoCAD Electrical 2017 for Electrical Control Designers, 8th Edition Rating: 3 out of 5 stars3/5Mastering Apple Music - The Ultimate iTunes User Guide Rating: 0 out of 5 stars0 ratings
Reviews for C++ Programming Language
1 rating0 reviews
Book preview
C++ Programming Language - Sherwyn Allibang
C++ Programming Language: Simple, Short, and Straightforward Way of Learning C++ Programming
Copyright 2016 - KDP Edition
Sherwyn Allibang
Edition License Notes
This book is authorized for your own personal use. This book may not be re-sold or offered away to other individuals. Much thanks to you for regarding the diligent work of the author.
Introduction
This book is for absolute beginners with or without prior knowledge in programming, as this book uses Simple words, Short sentences, and Straightforward paragraphs. The triple S way of learning C++ programming. C++ (pronounced as cee plus plus) is a general-purpose programming language. The main object of C++ is to add object-orientation to its predecessor C language. C++ has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation. There are also other useful features added to C++ such as inheritance and polymorphism. The topics covered in this book includes brief introduction to C++ programming, variables, data types, control structures, functions, pointers, and file management of external files. This book starts its discussion from short history to installation of the needed software resource and a step by step screen shots of how to write C++ programming code, compile and execute C++ programs. It presents graphical representation of algorithms for simpler learning. This book is packed with working and running C++ program samples and after reading this book, the reader would be able to develop and create C++ language programs based particularly from problems given in computer science courses, hence, adopting to other programming language will be a lot easier. This book is your initial step in your programming career.
TO GOD BE ALL THE GLORY!
The resources used in this book are:
> Personal Computer running Windows 7 Operating System
> Dev-C++ available at http://bloodshed.net
Other Operating Systems can also be used and you may also ought to use other C++ compilers or IDE.
NOTE: All links provided in this book are updated occasionally. If a link becomes unavailable, email me at [email protected]
Table of Contents
Acknowledgement
Dedication
Chapter 1 - Starting C++ Language Programming
Brief history of C++
Reasons to use C++
Beginning to Program in C++ Language
Installing the Dev-C++ for Windows
Installing compiler for Linux
Self-assessment questions
Chapter 2 - Our First C++ Program
Definition of programming terms
The components of a C++ program
Writing, compiling, and running our first program using Dev-C++ for Windows
Correcting errors
Writing, compiling, and running our first program with Linux
Compiling and running the program on Linux
Statements
Null Statements
White spaces
Self-assessment questions
Chapter 3 - Storing Data: Variables and Data Types in C++
Variable
Variable Declaration and definition
Scope of variables
Constants
Keywords
typedef declarations
Self-assessment questions
Chapter 4 - Fundamentals of Input And Output in C++
Displaying text on-screen
Accepting user input
Self-assessment questions
Chapter 5 - Arrays and Strings in C++
Array
Single-Dimensional
Multi-Dimensional Array
The C-Style Character String
Declaring and defining a string
Defining a string using input functions
C Strings' pre-defined functions in C++
Self-assessment questions
Chapter 6 - Mathematical Operations in C++
Expressions
Operators
Assignment Operator
Mathematical Operators
Binary
Unary
Mathematical operators precedence level and parentheses
Relational Operators
Logical Operators
Type Casting
Pre-defined Mathematical Functions
Self-assessment questions
Chapter 7 - Conditional Statements in C++
The if() statement
Single-alternative
Dual-alternative
Multiple-alternative
Nested if() statement
The switch() statement
Things to consider in conditional statement:
Self-assessment questions
Chapter 8 - Looping Statements in C++
What is a Loop?
Counter-controlled loop
Nested for() loop statement
Condition-controlled loop
Pre-test loop
Post-test loop
The Infinite Loop
Self-assessment questions
Chapter 9 - User-Defined Functions in C++ Language
User-defined function
User-defined function prototype
User-defined function definition
Calling a user-defined function
Things to consider in functions
Self-assessment questions
Chapter 10 - User-Defined Data Types in C++
Structures
Declaring a structure
Defining a structure
Accessing Structure Members
Compound declaration and definition of structure
Self-assessment questions
Chapter 11 - Classes in C++
What is a class?
Creating New Types
Classes and Members
Declaring of a Class in C++
Definition of a Class member method(s) in C++
Defining an Object of a class
Accessing Class Members
Private versus public access controls
Constructor and destructor
Self-assessment questions
Chapter 12 - Exception Handling in C++
What is exceptions?
How Exceptions Are Used
The basic steps in using exceptions
Self-assessment questions
Chapter 13 - Pointer in C++
Pointers in C++
Pointer Declaration
How pointers works?
Pointer Arithmetic
Self-assessment questions
Chapter 14 - File Management in C++
C++ Files and Streams
Opening a File
Closing a File
Writing to a File
Reading from a File
Self-assessment questions
Answers to self-assessment questions
Ending Notes
Disclaimer
About the Author
Acknowledgements
The author wishes to express his heartfelt gratitude to the Almighty God for His grace, wisdom, and guidance and for giving the author the determination to write this book. This book would not have been possible without the support and help of several individuals who in one way or another contributed and extended their valuable assistance in the preparation and completion of this material. The author offer his regards and blessings to all of those who supported him in any respect during the completion of this book.
Dedication
The author dedicates this book to the ALMIGHTY GOD.
This book is also dedicated to Dennis Ritchie for giving the author the tools to program and to Bill Gates for giving the author the reasons to program.
Chapter 1 - Starting C++ Language Programming
This chapter presents a brief overview of C++ programming. C++ was designed with a basis toward system programming with high performance, efficiency and flexibility of use as its design highlights. This chapter presents the things needed in starting C++ programming.
Brief history of C++
The C++ programming language has a history path in 1979. Bjarne Stroustrup, a Danish computer scientist, is working with the language called Simula
, which is a language principally intended for simulations. The Simula 67 language underpins object-oriented programming paradigm. Stroustup started working with C
with classes. C is considered as middle-level language which has the power of Low-level language but has high-level language features and C is considered as the predecessor of C++. Bjarne Stroustrup, at Bell Labs designed C++ in the early 80s, as an object oriented language based on the C language, which powered pretty much all systems software since its creation in 1972. The first C with Classes compiler was called Cfront, which was derived from a C compiler called CPre. C++'s goal is to add object-oriented programming into C language. The ++ operator in the C language is an operator for incrementing a variable, which gives some insight into how Stroustrup regarded the language. In 1985, Stroustrup's reference to the language entitled The C++ Programming Language
was published.
Reasons to use C++
To start with, C++ is highly recommended for beginning programmers in starting their programming career because C++ covers both procedural and object-oriented programming approach. Once someone learned the concepts behind programming language with C++, adopting or migrating to other programming language will be a lot easier whether it's object-oriented or procedural-oriented programming, as most of the things needed are pretty similar.
C++ has been around a while and it has solved several industry challenges considering that it is also the primary language that drives the mobile experience today. In addition to high performance server and middleware, C++ is a great choice for client side development on the two most popular mobile platforms Android and iOS and the two most popular desktop platforms, Windows and Mac OS X. With the recent introduction of developer tools that enable, among other things, visual design for clients, middleware, and server side apps; C++ is extremely productive and really makes it a great choice for modern app development, so learning the basics of C++ will make someone be competitive in the industry's stiff competition.
This book will bring the world of C++ programming closer to you.
Beginning to Program in C++ Language
All the C++ programs are written into text files with extension .cpp
for example hello.cpp
, where .cpp
is the extension file name. These text files are called source files. The source files contains the C++ source codes and will later be transformed into a running executable file. The program development cycle of C++ language are:
1. Write the source codes into a text editor (ex: notepad) to create the source file.
2. Compile the source file to create the object file.
3. The object file is link into an executable (ex: .exe for windows) file.
4. Run the program and see the result.
Based from the program development cycle of C++, notice that there are several things needed which includes a text editor, a compiler, and a linker. The good news is that, for Windows users, there is a software that comprises the three. It is called Dev-C++ which is available at http://bloodshed.net and for the download direct link at http://bloodshed-dev-c.en.softonic.com/download.
Dev-C++ is a C++ source code editor, a compiler, and a linker. All the things needed in creating a C program.
Note: You may ought to use other compilers as the sample codes in