C++
The Ultimate Beginners Guide!
Andrew Johansen
Copyright 2015 by Andrew Johansen - All rights reserved.
This document is geared towards providing exact and reliable information in regards to the topic and issue covered. The publication is sold with the idea that the publisher is not required to render accounting, officially permitted, or otherwise, qualified services. If advice is necessary, legal or professional, a practiced individual in the profession should be ordered.
- From a Declaration of Principles which was accepted and approved equally by a Committee of the American Bar Association and a Committee of Publishers and Associations.
In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved.
The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly.
Respective authors own all copyrights not held by the publisher.
The information herein is offered for informational purposes solely, and is universal as so. The presentation of the information is without contract or any type of guarantee assurance.
The trademarks that are used are without any consent, and the publication of the trademark is without permission or backing by the trademark owner. All trademarks and brands within this book are for clarifying purposes only and are the owned by the owners themselves, not affiliated with this document.
Table of Contents
Introduction
Chapter 1: The C++ Programming Language An Overview
Chapter 2: The C++ Environment
Chapter 3: The Basic Syntax of the C++ Programming Language
Chapter 4: The Different Data Types and Variable Types in C++
Chapter 5: The Scope of a Variable
Chapter 6: Literals/Constants
Chapter 7: Modifiers and Storage Classes
Chapter 8: The Operators in the C++ Language
Chapter 9: The Different Types of Loops in C++
Chapter 10: The Decision-Making Statements in C++
Chapter 11: The Different Functions in C++
Chapter 12: Numbers in the C++ Language
Chapter 13: C++ Arrays
Conclusion
Introduction
I want to thank you and congratulate you for getting my book
C++: The Ultimate Beginners Guide!
This book is written for people who want to learn the basics of the C++ programming language. If you are looking for a comprehensive book that will teach you everything you need to know about C++, this just might be what youre looking for.
By reading this book, youll learn the basics of C++. Youll discover the ideas, concepts, techniques, and methods used by expert C++ programmers. For example, this book will discuss variables, strings, functions, and data structures. That means youll be able to write programs using the C++ language after reading this material.
Thanks again for purchasing this book, I hope you enjoy it!
Chapter 1: The C++ Programming Language An Overview
C++ is a compiled, free-form, case-sensitive, multi-purpose, and statically typed programming language. It supports generic, procedural, and object-oriented programming.
Computer programmers consider C++ as an intermediate-level language, since it has both low-level and high-level features.
Bjarne Stroustrup, a Danish computer scientist, created C++ in 1979. Since he created this programming language as an improved version of C (another computer language), he called it C with Classes. However, during 1983, the name was changed to C++.
Important Note: A language is considered as statically typed if type checking is conducted during the compilation.
C++ - An Objected-Oriented Programming Language
C++ is compatible with object-oriented programming. It also supports the four foundations of object-oriented software development:
- Inheritance
- Encapsulation
- Polymorphism
- Data Hiding
The Three Major Parts of C++
The C++ programming language is composed of three major parts:
- Core Language This part serves as the foundation of C++ programs. It includes literals, variables, operators, etc.
- Standard Library This part provides a wide range of functions that you can use to manipulate the core language.
- Standard Template Library (also known as STL) This provides you with a wide range of methods and techniques that you can use with C++.
Learning this Programming Language
When studying C++, you should concentrate on ideas and concepts related to writing codes.
You are, after all, trying to learn a programming language because you want to be a good programmer. You would want to be effective in terms of maintaining old programs and creating new ones.
This programming language is compatible with a wide range of programming techniques. You may use it as C, Smalltalk, Fortran, etc. Regardless of your preferred programming style, youll surely achieve your goal of creating excellent programs and maintaining runtime efficiency.
Using this Programming Language
A lot of people all over the world are using C++. That means it is reliable and effective. Actually, C++ is one of the leading languages in the programming industry.
In general, programmers use C++ when writing device drivers and programs that require direct hardware control. Researchers and programming instructors use C++ to accomplish their tasks: this language is powerful and easy-to-use. Even beginners can master the basics of this language quickly.
According to computer experts, you are already using C++ if your computer runs on either Windows or Macintosh. This is because these operating systems were written using C++.
Chapter 2: The C++ Environment
You dont have to establish your own C++ environment when reading this book. This is because there are online tools that you can use to write and compile C++ codes. These tools are user-friendly and capable of giving immediate feedback. That means youll quickly discover the mistakes in your programs. One of the most popular online programming tools is www.compileonline.com . You may access that site using your favorite browser as you read this book.
To help you get started, heres a basic code that you can use with www.compileonline.com :
Try running this code on an online programming environment. You should immediately see the resulting program.
Setting Up a Local C++ Environment
If you still want to establish a local environment for the C++ language, your computer must have the following programs:
- Text Editing Software Youll use a text editor to write your C++ programs. Here are the text editors commonly used by C++ programmers: vi, vim, Brief, EMACS, and Windows Notepad.
The text editors name and version may change, depending on your machines operating system. For instance, Notepad serves as the default text editor for Windows computers. Vi or vim, however, are compatible with UNIX, Linux, and Windows machines.
The text files youll produce using an editor are known as source files. In the C++ language, these files end with the following extensions: .c, .cp, or .cpp.
Next page