
- 526 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Beginning C++ Programming
About this book
Modern C++ at your fingertips!About This Book⢠This book gets you started with the exciting world of C++ programming⢠It will enable you to write C++ code that uses the standard library, has a level of object orientation, and uses memory in a safe and effective way⢠It forms the basis of programming and covers concepts such as data structures and the core programming languageWho This Book Is ForA computer, an internet connection, and the desire to learn how to code in C++ is all you need to get started with this book.What You Will Learn⢠Get familiar with the structure of C++ projects⢠Identify the main structures in the language: functions and classes⢠Feel confident about being able to identify the execution flow through the code⢠Be aware of the facilities of the standard library⢠Gain insights into the basic concepts of object orientation⢠Know how to debug your programs⢠Get acquainted with the standard C++ libraryIn DetailC++ has come a long way and is now adopted in several contexts. Its key strengths are its software infrastructure and resource-constrained applications, including desktop applications, servers, and performance-critical applications, not to forget its importance in game programming. Despite its strengths in these areas, beginners usually tend to shy away from learning the language because of its steep learning curve.The main mission of this book is to make you familiar and comfortable with C++. You will finish the book not only being able to write your own code, but more importantly, you will be able to read other projects. It is only by being able to read others' code that you will progress from a beginner to an advanced programmer. This book is the first step in that progression.The first task is to familiarize you with the structure of C++ projects so you will know how to start reading a project. Next, you will be able to identify the main structures in the language, functions, and classes, and feel confident being able to identify the execution flow through the code. You will then become aware of the facilities of the standard library and be able to determine whether you need to write a routine yourself, or use an existing routine in the standard library.Throughout the book, there is a big emphasis on memory and pointers. You will understand memory usage, allocation, and access, and be able to write code that does not leak memory. Finally, you will learn about C++ classes and get an introduction to object orientation and polymorphism.Style and approachThis straightforward tutorial will help you build strong skills in C++ programming, be it for enterprise software or for low-latency applications such as games or embedded programming. Filled with examples, this book will take you gradually up the steep learning curve of C++.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Exploring C++ Types
Exploring built-in types
Integers
int height = 480;
int width = 640;
int aspect_ratio = width / height;
float aspect_ratio = width / height;
float aspect_ratio = width / (float)height;
| Type | Range | Size in bytes |
| signed char | -128 to 127 | 1 |
| short int | -32768 to 32767 | 2 |
| int | -2147483648 to 2147483647 | 4 |
| long int | -2147483648 to 2147483647 | 4 |
| long long int | -9223372036854775808 to 9223372036854775807 | 8 |
// #include <cstdint>
using namespace std; // Values for x86
cout << sizeof(int8_t) << endl; // 1
cout << sizeof(int16_t) << endl; // 2
cout << sizeof(int32_t) << endl; // 4
cout << sizeof(int64_t) << endl; // 8
Specifying integer literals
Table of contents
- Title Page
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Starting with C++
- Understanding Language Features
- Exploring C++ Types
- Working with Memory, Arrays, and Pointers
- Using Functions
- Classes
- Introduction to Object-Orientated Programming
- Using the Standard Library Containers
- Using Strings
- Diagnostics and Debugging