12,99 €
The quick and crystal-clear guide to C++ programming
C++ Essentials For Dummies is your useful reference to the key concepts of C++, the popular general-purpose language utilized everywhere from building games to writing parts of operating systems. With minimal review and background material—and absolutely no fluff—this book gets straight to the essential topics you need to know to ramp up, brush up, or level up.
Great for supplementing classroom learning, reviewing for a certification, or staying knowledgeable on the job, C++ Essentials For Dummies is a fantastic refresher guide that you can always turn to for answers.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 213
Veröffentlichungsjahr: 2024
Cover
Title Page
Copyright
Introduction
About This Book
Foolish Assumptions
Icons Used in This Book
Where to Go from Here
Chapter 1: Compiling and Running Your First C++ Application
Looking at a Simple C++ Program
Using C++ on Microsoft Windows
Using C++ on Apple macOS
Using C++ on Linux
Working with an Integrated Development Environment
Chapter 2: Storing Data in C++
Storing Values in Variables
Manipulating Integer Variables
Working with Character Variables
Using Strings
Telling the Truth with Boolean Variables
Using Floating-Point Values in a Variable
Printing Float and Double Values
Making Your Code More Readable with Enumerations
Reading from the Console
Chapter 3: Directing the Application Flow
Filling Your Code with Comments
Evaluating Conditions in C++
Using If Statements and Conditions
Making Decisions Using a Conditional Operator
Repeating Actions with Statements That Loop
Looping for
Looping while
Doing while
Breaking and Continuing
Nesting Loops
Using Switch Statements
Chapter 4: Dividing Your Work with Functions
Dividing Your Work
Calling a Function
Writing Your Own Functions
Improving On the Basic Function
Calling All String Functions
Understanding main()
Chapter 5: Splitting Up Source Code Files
Creating Multiple Source Files
Sharing with Header Files
Sharing Variables among Source Files
Using the Mysterious Header Wrappers
Using Constants
Understanding Preprocessor Directives
Chapter 6: Referring to Your Data through Pointers
Considering the Issues with Pointers
Heaping and Stacking the Variables
Creating New Pointers
Freeing Pointers
Passing Pointer Variables to Functions
Returning Pointer Variables from Functions
Chapter 7: Working with Classes
Understanding Objects and Classes
Working with a Class
Starting and Ending with Constructors and Destructors
Building Hierarchies of Classes
Chapter 8: Working with Arrays and Pointers
Declaring Arrays
Using Arrays and Pointers
Using Multidimensional Arrays
Working with Arrays and Command-Line Parameters
Allocating an Array on the Heap
Deleting an Array from the Heap
Chapter 9: Ten Features for More Advanced C++ Programming
Conditional Compilation
Namespaces
File I/O
Exception Handling
Operator Overloading
STL Vectors
STL Maps
STL Iterators
Algorithms Library
Smart Pointers
Index
About the Author
Connect with Dummies
End User License Agreement
Chapter 3
TABLE 3-1 Evaluating Numerical Conditions
TABLE 3-2 Choosing Your Loops
Chapter 1
FIGURE 1-1: Using the Eclipse CDT integrated development environment (IDE).
Cover
Table of Contents
Title Page
Copyright
Begin Reading
Index
About the Author
iii
iv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
181
182
183
C++ Essentials For Dummies®
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2025 by John Wiley & Sons, Inc. All rights reserved, including rights for text and data mining and training of artificial technologies or similar technologies.
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit https://hub.wiley.com/community/support/dummies.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number is available from the publisher.
ISBN 978-1-394-30788-3 (pbk); ISBN 978-1-394-30790-6 (ebk); ISBN 978-1-394-30789-0 (ebk)
Welcome to C++ Essentials For Dummies. This book contains the basic information you need to know to get going with C++ programming. You’ll learn how to install and run the compiler, write programs, and use important C++ features like arrays, classes, and pointers to do good object-oriented programming.
C++ is a large and complex language. But whether you’re just learning to program or you’re an expert in other programming languages, this book contains the essentials of the language for you to quickly become a C++ programmer.
C++ Essentials For Dummies contains the information you need to start writing C++ programs. You can compile and run the example programs with the latest C++ 20 version of the compiler, but you can also use the earlier C++ 14 and C++ 17 versions.
This book is not a comprehensive reference for C++. To go beyond what this book covers, your next book should be C++ All-in-One For Dummies, 4th Edition by John Paul Mueller, from which this book is derived. However, this book will get you up and running fast with its easy-to-follow For Dummies format.
We made a few basic assumptions about you, the reader:
You own or have access to a relatively modern computer.
The C++ example programs were tested on a Windows computer, but the book shows how to compile and run them just as easily on a Mac or Linux computer.
You’re an experienced computer user.
In other words, we assume that you know the basics of using your computer, such as starting programs and working with the file system.
You’re interested in learning how to write programs in the C++ language.
That’s what this book is about, so it’s a fair assumption.
We do not assume you have any previous programming experience in C++ or in any other programming language.
Like any For Dummies book, this book is chock-full of helpful icons that draw your attention to items of particular importance. You find the following icons throughout this book:
Danger! This icon highlights information that may help you avert disaster.
Did we tell you about the memory course we took?
Pay special attention to this icon; it lets you know that some particularly useful tidbit is at hand.
If you’re new to programming, you’ll benefit most from this book by reading it from start to end. But if you’re familiar with programming in another language, especially an object-oriented language like Java, you can pick and choose which chapters and topics to read to learn what’s unique about C++.