C++ For Dummies
eBook - ePub

C++ For Dummies

Stephen R. Davis

Partager le livre
  1. English
  2. ePUB (adapté aux mobiles)
  3. Disponible sur iOS et Android
eBook - ePub

C++ For Dummies

Stephen R. Davis

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

The best-selling C++ For Dummies book makes C++ easier!

C++ For Dummies, 7 th Edition is the best-selling C++ guide on the market, fully revised for the 2014 update. With over 60% new content, this updated guide reflects the new standards, and includes a new Big Data focus that highlights the use of C++ among popular Big Data software solutions. The book provides step-by-step instruction from the ground up, helping beginners become programmers and allowing intermediate programmers to sharpen their skills. The companion website provides all code mentioned in the text, an updated GNU_C++, the new C++ compiler, and other applications. By the end of the first chapter, you will have programmed your first C++ application!

As one of the most commonly used programming languages, C++ is a must-have skill for programmers who wish to remain versatile and marketable. C++ For Dummies, 7 th Edition provides clear, concise, expert instruction, which is organized for easy navigation and designed for hands-on learning. Whether you're new to programming, familiar with other languages, or just getting up to speed on the new libraries, features, and generics, this guide provides the information you need.

  • Provides you with an introduction to C++ programming
  • Helps you become a functional programmer
  • Features information on classes, inheritance, and optional features
  • Teaches you 10 ways to avoid adding bugs

The book incorporates the newest C++ features into the fundamental instruction, allowing beginners to learn the update as they learn the language. Staying current on the latest developments is a crucial part of being a programmer, and C++ For Dummies, 7 th Edition gets you started off on the right foot.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que C++ For Dummies est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  C++ For Dummies par Stephen R. Davis en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et Programmation en C. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Éditeur
For Dummies
Année
2014
ISBN
9781118823835
Édition
7
Part I

Getting Started with C++ Programming

9781118823774-pp0101.tif
webextras.eps
Visit www.dummies.com for great Dummies content online.
In this part

  • Explaining the building blocks
  • Declaring variables
  • Defining mathematical operators
  • Using logical operators
  • Visit www.dummies.com for great Dummies content online.
Chapter 1

Writing Your First C++ Program

In This Chapter
arrow
Finding out about C++
arrow
Installing Code::Blocks on Windows, Ubuntu Linux, or Macintosh OS X
arrow
Creating your first C++ program
arrow
Executing your program
Okay, so here we are: No one here but just you and me. Nothing left to do but get started. Might as well lay out a few fundamental concepts.
A computer is an amazingly fast but incredibly stupid machine. A computer can do anything you tell it (within reason), but it does exactly what it’s told — nothing more and nothing less.
Perhaps unfortunately for us, computers don’t understand any reasonable human language — they don’t speak English either. Okay, I know what you’re going to say: “I’ve seen computers that could understand English.” What you really saw was a computer executing a program that could meaningfully understand English.
Computers understand a language variously known as computer language or machine language. It’s possible but extremely difficult for humans to speak machine language. Therefore, computers and humans have agreed to sort of meet in the middle, using intermediate languages such as C++. Humans can speak C++ (sort of), and C++ can be converted into machine language for the computer to understand.

Grasping C++ Concepts

A C++ program is a text file containing a sequence of C++ commands put together according to the laws of C++ grammar. This text file is known as the source file (probably because it’s the source of all frustration). A C++ source file normally carries the extension .CPP just as an Adobe Acrobat file ends in .PDF or an MS-DOS (remember that?) batch file ends in .BAT.
The point of programming in C++ is to write a sequence of commands that can be converted into a machine-language program that actually does what we want done. This conversion is called compiling and is the job of the compiler. The machine code that you wrote must be combined with some setup and teardown instructions and some standard library routines in a process known as linking. Together, compiling and linking are known as building. The resulting machine-executable files carry the extension .EXE in Windows. They don't carry any particular extension in Linux or Macintosh.
That sounds easy enough — so what’s the big deal? Keep going.
To write a program, you need two specialized computer programs. One (an editor) is what you use to write your code as you build your .CPP source file. The other (a compiler) converts your source file into a machine-executable file that carries out your real-world commands (open spreadsheet, make rude noises, deflect incoming asteroids, whatever).
Nowadays, tool developers generally combine compiler and editor into a single package — a development environment. After you finish entering the commands that make up your program, you need only click a button to build the executable file.
Fortunately, there are public-domain C++ environments. I use one of them in this book — the Code::Blocks environment. This editor will work with a lot of different compilers, but the version of Code::Blocks combined with the GNU gcc compiler used to write this book is available for download for Windows, Macintosh, and various versions of Linux, as described in the installation section of this chapter.
Although Code::Blocks is public domain, you’re encouraged to pay some small fee to support its further development. You don’t have to pay to use Code::Blocks, but you can contribute to the cause if you like. See the Code::Blocks website for details.
I have tested the programs in this book with Code::Blocks 13.12 which comes bundled with gcc version 4.7.1. This version of gcc implements most of the C++ 2011 standard.
c++11_fmt.eps
You can use different versions of gcc or even different compilers if you prefer, but they may not implement the complete '11 standard. For that reason, 2011 extensions are marked with the '11 icon seen here.
c++14_fmt.eps
The gcc compiler does not implement any of the extensions added in the C++ 2014 standard as of this writing, but I have included them, where applicable, because some day it will.
Okay, I admit it: This book is somewhat Windows-centric. I have tested all of the programs in the book on Windows 2000/XP/Vista/7/8, Ubuntu Linux, and Macintosh OS X. I flag any differences between operating systems in the text. In addition, I include installation instructions for each of the above three operating systems in this chapter. Versions of Code::Blocks and gcc are available for other flavors of Linux and other versions of the Macintosh OS. The programs should work with these, as well.
warning.eps
The Code::Blocks/gcc package generates 32-bit programs, but it does not easily support creating “windowed” programs. The programs in this book run from a command line prompt and write out to the command line. As boring as that may sound, I strongly recommend that you work through the examples in this book fir...

Table des matiĂšres