Chapter 3
Writing Your First Program
In This Chapter
Entering your first C++ program
Compiling and executing your program
Examining some things that could go wrong
Executing your program
Reviewing how the program works
This chapter guides you through the creation of your first program in C++, using the Code::Blocks C++ environment. It’s a bit “cookbookish” because I assume this is your first time programming in C++. I explain all the parts that make up this program in subsequent chapters (beginning with Part II), but for now, you’ll be asked to accept a few things on faith. After you’ve had a chance to see it all work together once, all will be revealed — and everything you do in this chapter will make perfect sense.
Creating a New Project
As always, you must create a new project to house your program. Follow the abbreviated steps here (or you can use the detailed steps from Chapter 2):
- With Code::Blocks open, select File⇒New⇒Project.
- Select Console Applications and select Go (or ...
Get Beginning Programming with C++ For Dummies, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.