O'Reilly logo

Beginning Programming with C++ For Dummies® by Nat Coalson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 will guide you through the creation of your first program in C++. You will be using the Code::Blocks C++ environment. It will all be a bit "cookbookish" since this is your first time. I explain all of 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. Soon 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):

  1. With Code::Blocks open, select File

    Creating a New Project
  2. Select Console Applications and select Go (or double-click on the Console Applications icon).

  3. Select C++ as your language of choice and select Next.

  4. Enter Conversion as the Project Title.

    If you followed the steps in Chapter 2, the "Folder to create project in" should already be set to Beginning_Programming-CPP. If not, it's not too late to click the ... button and create the folder in the root of your working disk. (This is described in detail in Chapter 2.) The Code::Blocks Wizard fills in the name of the Project and the name of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required