Dummies 101: C++ Programming

Overview

Whether you've programmed in other computer languages or are ready to add a valuable new skill to your repertoire, Dummies 101: C++ Programming is the ideal step-by-step tutorial to get you started. Here, programming professional and author Namir Clement Shammas shares his expertise in the form of clear, easy-to-follow lessons and fun quizzes. Learning to program in the object-oriented C++ language can be daunting; but with Dummies 101: C++ Programming, you quickly find yourself writing your own real programs and...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (7) from $1.99   
  • New (1) from $0.00   
  • Used (6) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$1.99
Seller since 2007

Feedback rating:

(10265)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Very Good
Book has appearance of light use with no easily noticeable wear. Millions of satisfied customers and climbing. Thriftbooks is the name you can trust, guaranteed. Spend Less. Read ... More. Read more Show Less

Ships from: Auburn, WA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$1.99
Seller since 2015

Feedback rating:

(4249)

Condition: Acceptable
Free State Books. Never settle for less.

Ships from: Halethorpe, MD

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$1.99
Seller since 2010

Feedback rating:

(5812)

Condition: Good
This book has a light amount of wear to the pages, cover and binding. Blue Cloud Books ??? Hot deals from the land of the sun.

Ships from: Phoenix, AZ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$3.00
Seller since 2014

Feedback rating:

(2)

Condition: Good
1996 Paperback Good Connecting readers with great books since 1972. Used books may not include companion materials, some shelf wear, may contain highlighting/notes, and may not ... include cd-rom or access codes. Customer service is our top priority! Read more Show Less

Ships from: Chesterfield, MO

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$29.51
Seller since 2015

Feedback rating:

(337)

Condition: Good
Possible retired library copy, some have markings or writing. May or may not include accessories such as CD or access codes.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$29.54
Seller since 2015

Feedback rating:

(337)

Condition: Very Good
Very good.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Whether you've programmed in other computer languages or are ready to add a valuable new skill to your repertoire, Dummies 101: C++ Programming is the ideal step-by-step tutorial to get you started. Here, programming professional and author Namir Clement Shammas shares his expertise in the form of clear, easy-to-follow lessons and fun quizzes. Learning to program in the object-oriented C++ language can be daunting; but with Dummies 101: C++ Programming, you quickly find yourself writing your own real programs and understanding programs that others have written. Plus, to get you off to a good start, the book includes a valuable CD-ROM containing everything from the source code presented in the text to Turbo C++ Lite, a complete programming environment featuring a text editor and compiler. Plus, for Windows users, the disc contains two bonus units.

With Dummies 101: Visual C++ Programming, even absolute beginners with no prior experience in any programming language can learn to write Visual C++ programs. The easy-to-use tutorial helps users become more comfortable and confident using Visual C++ language. With the hands-on exercises and screenshots, users will immediately begin to understand C++ programming enough to move forward and begin writing programs.

Read More Show Less

Product Details

  • ISBN-13: 9780764500732
  • Publisher: Wiley, John & Sons, Incorporated
  • Publication date: 12/1/1996
  • Series: Dummies 101 Series
  • Edition number: 1
  • Pages: 288
  • Product dimensions: 8.23 (w) x 10.82 (h) x 0.85 (d)

Table of Contents

Introduction

Why You're Reading This Book
How This Book Is Organized
Part I: Getting Started
Part II: The Core of C++
Part III: More-Advanced Topics
Appendixes
Icons Used in This Book
Using the CD-ROM
Stuff You Should Know

Part I: Getting Started

Unit 1: Getting to Know Your Compiler
Lesson 1-1: Creating a Program: An Overview
Lesson 1-2: The Turbo C++ Lite Environment
Lesson 1-3: Managing Files
The Quit command
The Change dir command
The New command
The Save As command
The Save command
The Open command
The Print command
Lesson 1-4: Getting to the Source Code
Lesson 1-5: Compiling and Linking Files
The Compile to OBJ command
The Link EXE file command
The Make EXE file
Lesson 1-6: Running Programs
Unit 1 Quiz
Unit 1 Exercise
Unit 2: Naming Identifiers (What's in a Name?)
Lesson 2-1: Rules for Naming Things
Examples of valid names
Examples of invalid names
Lesson 2-2: Programming Punctuation
The semicolon
The open and closed braces
The operators
Unit 2 Quiz
Unit 2 Exercise
Unit 3: You're Not My Data Type
Lesson 3-1: Using the Integer Data Type
Lesson 3-2: Using Floating-Point Types
Lesson 3-3: Using the Character Type
Lesson 3-4: Using the String Type
Unit 3 Quiz
Unit 3 Exercise
Unit 4: Checking Out Constants and Variables
Lesson 4-1: What's a Constant?
Lesson 4-2: What's a Variable?
Lesson 4-3: Declaring Constants
Naming constants
Declaring and using constants
Lesson 4-4: Declaring Variables
Declaring and using variables of different data types
Declaring and using variables of the same type
Lesson 4-5: Initializing Variables
Initializing the variables Letter, Number, and Integer
Initializing the variables Length, Width, and Height
Lesson 4-6: Assigning Your Own Values
Using your input to assign values
Assigning values to dimensions of a solid
Lesson 4-7: Now Try Variables on Both Sides!
Unit 4 Quiz
Unit 4 Exercise
Unit 5: Some Pointers on Pointers
Lesson 5-1: What's a Pointer?
Lesson 5-2: Declaring a Pointer
Form 1: Declaring single pointers
Form 2: Declaring multiple pointers
Lesson 5-3: Initializing a Pointer
Lesson 5-4: Using a Pointer
Declaring and using simple pointers
More cultured use of pointers
Using the same pointer to access different variables
Hiring pointers full-time
Unit 5 Quiz
Unit 5 Exercise
Unit 6: Fiddling with Functions
Lesson 6-1: I Do Declare -- Declaring Functions
Lesson 6-2: The Parameters of a Function
Lesson 6-3: Function Prototyping
Function prototyping example
The main advantage of function prototypes
Lesson 6-4: A Variety of Parameters
Using a function with a pointer parameter
Using a function with a reference parameter
Using a function with multiple parameters
Using a function with multiple reference parameters
Parameter rules!
Unit 6 Quiz
Unit 6 Exercise
Part I Review
Part I Test
Part I Lab Assignment

Part II: The Core of C++

Unit 7: Moving to the Head of the Class
Lesson 7-1: What on Earth Is a Class?
Lesson 7-2: Declaring a Class
Declaring class Rabbit
Declaring a class public
Declaring a class protected
Declaring a class private
Lesson 7-3: Using Member Functions to Manipulate Data Members
Using header and implementation files with class Rabbit
Defining member functions inside the class Rabbit declaration
Lesson 7-4: Using Class Constructors
Lesson 7-5: Declaring Class Instances
Unit 7 Quiz
Unit 7 Exercise
Unit 8: Those Silly Operators and Expressions
Lesson 8-1: Doctor, I Need a Mathematical Operator
Lesson 8-2: The Increment Operators
Lesson 8-3: Hello, Operator? I Need an Assignment
Lesson 8-4: It's Only Logical That Operators Are Related
Perfectly logical operator
It's all relative
Logical and relational operators in action
Lesson 8-5: Express Yourself Mathematically
Lesson 8-6: That Seems Logical
Unit 8 Quiz
Unit 8 Exercise
Unit 9: Decisions, Decisions, Decisions!
Lesson 9-1: Making True/False Decisions
Lesson 9-2: Choosing from Two Alternatives
Lesson 9-3: Choosing Among Multiple Alternatives
Lesson 9-4: Choosing Among Several Alternatives: A Simpler Approach
Unit 9 Quiz
Unit 9 Exercise
Unit 10: Knocking Your Program for a Loop
Lesson 10-1: Repeating Tasks with Loops
Lesson 10-2: Looping a Fixed-Number of Times
Using a simple for loop
Using different for loops
Lesson 10-3: I'll Loop on One Condition
Lesson 10-4: An Additional Conditional
Unit 10 Quiz
Unit 10 Exercise
Unit 11: Handling Vast (And Not-So-Vast) Arrays g
Lesson 14-4: Copying and Appending Strings
Lesson 14-5: Comparing Strings
Unit 14 Quiz
Unit 14 Exercise
Part III Review
Part III Test
Part III Lab Assignment
Appendix A: Answers
Appendix B: About the CD
System Requirements
What's on the CD
Putting the CD Files on Your Hard Drive
Installing the CD-ROM in Windows
Installing the CD-ROM in DOS
Running Turbo C++ Lite
After installing the files . . .
Accessing the CD files
Removing the CD files
Index
License Agreement
Installation Instructions
Read More Show Less

First Chapter

Unit 1
Getting to Know Your Compiler

Objectives for This Unit

  • Learning the basics of creating a program
  • Running the Turbo C++ Lite environment
  • Managing Files
  • Discussing the source code for you first C++ program
  • Using the editor
  • Compiling and linking souce code files
  • Running programs



Welcome to the first unit of Dummies 101: C++ Programming. This unit introduces you to the C++ programming language and to compilers, which are tools that run programs created with C++. In the back of this book, you'll find a disc that contains the Turbo C++ Lite compiler. You can use other compilers (such as Microsoft Visual C++) if you choose to, but Turbo C++ Lite is the one I recommend -- and it comes free with this book, so how can you go wrong?

In this unit, you learn about the essential commands in the Turbo C++ Lite environment to write (and maintain) the source code for programs and convert that code into running programs.

Lesson 1-1: Creating a Program: An Overview

When you turn on your PC, you automatically launch a whole slew of programs that breathe life into your computer. Each program contains low-level machine instructions that your computer can understand and execute but that are very cryptic to the ordinary human. These instructions are made up of nothing more than 0s and 1s -- lots and lots of 0s and 1s. So how can you learn to create programs containing such mind-numbing instructions without turning your brain to mush?

At first, programmers did have to learn to talk in the language of the computer's central processing unit (CPU, for short). The CPU is the brain of the computer -- it understands and executes the low-level machine instructions. But programmers quickly caught on to the fact that the tedious task of talking directly to the CPU is not a popular one! These programmers devised a method in which a person, like yourself, writes a set of English-like instructions (called the source code). The computer uses a special set of programs to translate the source code into the low-level machine instructions that the CPU understands. (You will find that while most programmers don't have to learn the CPU's language, a few programmers still do to create very fast programs.)

The following general steps explain the process of turning source code into instructions that your computer can understand:

  1. Use a text editor to write the human-readable source code.

    Typically, you save the source code in a file so that you can view it, print it, and maybe modify it later.

  2. Invoke a special program called the compiler to translate your source code into the object code, the intermediate version between the source code and the low-level machine instructions.

    The compiler points out any errors in your source code -- sort of like your mom checking over your homework. Such errors basically occur when you deviate from the syntax (that is the pattern and rules) of the programming language that you're using.

  3. Invoke the linker, which translates the object code generated by the compiler into low-level machine instructions.

    The name linker comes from the fact that this program links, or connects, the object code to chunks of low-level instructions hidden in other files.

So the basic process of creating a program involves writing the source code, compiling it, and linking the result. That's all. The good news, as the next lesson explains in more detail, is that the Turbo C++ Lite environment allows you to combine the steps of compiling, linking, and even running a program as soon as you have the program's source code ready!

Lesson 1-2: The Turbo C++ Lite Environment

The Turbo C++ Lite environment is a menu-driven program that enables you to create and manage C++ programs (see Appendix B for details on installing Turbo C++ Lite and the exercise files that accompany the lessons in this book). Figure 1-1 shows the Turbo C++ Lite environment in a sample session on a computer running Windows 95. Notice the text editor window (also called an Edit window), with the title NONAME00.CPP, in that figure. The environment has the following menus in the main menu bar:

  • The File menu provides choices for opening and loading existing files, creating new files, shelling to DOS (that is, spawning a DOS prompt without exiting Turbo C++ Lite), saving files, and exiting Turbo C++ Lite.
  • The Edit menu supplies commands to cut, copy, and paste text in Edit windows. You can also open a Clipboard window (which isn't the same as the Clipboard in Windows 3.1 or Windows 95) to view or edit the Clipboard contents.
  • The Search menu provides commands to search for text in the source code.
  • The Run menu provides commands to compile, link, and run your program all at once.
  • The Compile menu allows you to compile the program in the active Edit window; compile, make (that is, create or update the program file), or link your program; or build your project. (When you build a project, you create or re-create the program file. Building projects is beyond the scope of this book.)
  • The Debug menu offers commands to control all the features of the integrated debugger. (This part of Turbo C++ Lite is beyond the scope of this book.)
  • The Project menu contains commands that allow you to create and manage programs that use multiple source code files. (These kinds of programs are beyond the scope of this book.)
  • The Options menu contains commands that let you view and change various default settings in Turbo C++ Lite. Most of the commands in this menu lead to dialog boxes.
  • The Window menu contains commands that allow you to manage Turbo C++ Lite windows in a manner that is similar to Windows 3.1 and Windows 95.
  • The Help menu provides access to built-in help, which appears in a special Help window. The Help system provides information on virtually all aspects of the Turbo C++ Lite environment.

The next sections cover the basic menu commands that you need to use for creating C++ programs.

Lesson 1-3: Managing Files

The File menu offers the commands New, Open, Save As, Save, Change dir, Print, and Quit, all of which you use in this book. The next subsections discuss these commands in order of importance.

The Quit command

The Quit command allows you to exit the Turbo C++ Lite environment. If you have an Edit window open with text that you haven't saved, the environment prompts you with a dialog box to save it. The shortcut key combination for the Quit command is Alt+X.

The Change dir command

The Change dir command empowers you to select a new directory and make it the current directory for saving and loading source code files. This command invokes the Change Directory dialog box that appears in Figure 1-2.

Try the following exercise to practice using the Change dir command:

  1. Choose File-->Change dir.

    The Turbo C++ Lite environment brings up the Change Directory dialog box. The dialog box has a list box containing the current directory, its subdirectories, and its parent directories. In other words, the dialog box shows a partial view of the directory tree structure.

  2. Double-click the TCLITE directory in the directory list box.

    The dialog box selects that directory and displays any child subdirectories attached to the directory you selected. (You can also select a directory by clicking that directory and then clicking the Chdir button.) A child directory (or subdirectory) is one that is attached (or connected, if you prefer) to the parent directory. Each child subdirectory has only one parent directory. A parent directory may have any number of child subdirectories.

  3. Double-click the DUMMY101 directory in the directory list box.
  4. Double-click the UNIT1 directory in the directory list box.
  5. Click OK to make \TCLITE\DUMMY101\UNIT1 the current directory.

    Or to revert to the original directory, click the Revert button and then click OK.

The New command

The New command invokes a new Edit window. The first Edit window has the default name of NONAME00.CPP, the second default Edit window has the name of NONAME01.CPP, and so on. After choosing File-->New, you can start typing the source code of a program in the new Edit window. Of course, you have to learn how to type C++ source code first, but that's another story.

Remember that every Edit window has a text file associated with it. Also, keep in mind that the Turbo C++ Lite environment supports multiple Edit windows. The active Edit window is simply the one you are working in at a given time.

Try opening a new window and typing some text in it:

  1. Choose File-->New.
  2. Turbo C++ Lite displays a new Edit window with the title NONAME00.CPP.

  3. Type the following text:
  4. // Your first C++ program

    #include <iostream.h>

    // this is a comment
    /* and so is this */
    /*
    and so is this one
    */

    main()
    {
    // the next statement displays a greeting message
    cout << "Hello World!";

    return 0;
    }

    I discuss the various parts of this listing later in this unit.

The Save As command

The Save As command allows you to save the current contents of an Edit window in a new file, under a new name. When you choose the Save As command, you get the Save File As dialog box, shown in Figure 1-3, where you type the new filename in the Save File As edit box.

The Save File As dialog box also contains a list box that displays the names of the .CPP files (that is, the names of every file that has the .CPP file extension) in the current directory. When you save a file under a new name, you don't have to save it to the current directory. To go to the parent directory and navigate through directories from there, click the ..\ entry.

Try using these instructions to save the contents of the current Edit window (the one you created in the preceding exercise) in the file HELLO.CPP:

  1. Choose File-->Save As.
  2. This step brings up the Save File As dialog box.

  3. Type the name HELLO in the Save File As edit box.

    You don't have to type .CPP, because the environment automatically appends this extension to the filename you enter.

  4. Click OK.

    The environment updates the title of the Edit window to HELLO.CPP.

  5. Close the currently selected Edit window by choosing Window-->Close.

    The shortcut for the Close command is Alt+F3.

The Save command

The Save command saves the contents of the currently selected Edit window in the associated text file. If you invoke the Save command with a new Edit window, the environment brings up the Save Edit File dialog box (which is very similar to the Save File As dialog box) to prompt you for a filename. The dialog box contains the Save Editor File As edit box, which displays the default filename. You can alter this default filename by typing a different filename.

Use the Save command to periodically save the contents of the currently selected Edit window.

The Open command

The Open command enables you to load a file into a new or the current Edit window. This command brings up the Load a File dialog box, shown in Figure 1-4. The dialog box contains the Name combo box, which allows you to specify a new wildcard for the list of files to view in the Files list box.

A wildcard is a character (DOS uses the * and ? characters) that represents one or more general letters in a filename. The ? wildcard represents a single letter. For example the wildcard ??.EXE refers to all files, such as WC.EXE and AP.EXE, whose primary names consist of 2 letters. The * wildcard represents multiple letters. For example the wildcard *.EXE refers to all files (such as EXCEL.EXE, WORD.EXE, and WG.EXE) that have the .EXE extension name.

To select a file in the list box, click that file. Then you can either click the Open button to open the selected file in a new Edit window, or click the Replace button to load the selected file into the current Edit window. The Replace button is usable only when an Edit window is open.

Now try opening your first program file. Follow these steps to load the file HELLO.CPP into a new Edit window:

  1. Choose File-->Open.

    This step brings up the Open a File dialog box.

  2. Select the file HELLO by clicking it.
  3. Click the Open button.

    The environment loads the contents of the file HELLO.CPP in a new Edit window.

Using the Editor

Whenever you bring up the Edit window to work on new or existing source code, you're using the Turbo C++ Lite built-in text editor without even knowing it. You could use your favorite DOS or Windows text editor to edit your code, but why go to the extra trouble when the Turbo C++ Lite built-in text editor lets you edit, compile, link, and run programs without even leaving the Turbo C++ Lite environment.

The Print command

The Print command prints the contents of the currently selected Edit window. You'll find that having a hard copy of your source code can be handy when you're trying to figure out what you're doing wrong, or when you want to show it to someone else. To print just part of the source code, select that part with the mouse and then choose the Print command. To print the entire source code in the current Edit window, clear any selected text (by clicking the mouse button anywhere in the Edit window) and then choose the Print command.

Lesson 1-4: Getting to the Source Code

In the preceding lesson, you entered the source code for your first C++ program. The first line in the program contains the following comment:

// Your first C++ program

This type of code fragment -- a line of text starting with the // characters -- is called a one-line comment. When the compiler sees such a comment, it ignores the text that comes after the // until it reaches the end of the same line. Why would you want to write code that the compiler is just going to ignore? In general, programmers write comments to make the code easier to understand. In addition comments help programmers to remind themselves and others of the tasks that the code performs. Professional programmers may use such comments to state the date they wrote the source code, to note the version number, to list the programmers' names, and so on.

The second line of your source code includes the following special statement called a directive:

#include <iostream.h>

The #include directive is a special kind of instruction to the compiler. This directive tells the compiler to include (that is, merge) the source code in another file (in this case, the file IOSTREAM.H) with the current code listing. That way, you don't have to retype a bunch of code lines that are already included in another listing. In this example, the compiler takes the file IOSTREAM.H -- which is one of the standard files included with Turbo C++ Lite -- and incorporates the code from that program into your HELLO.CPP program. (Don't worry if you don't know where the IOSTREAM.H file is located -- the compiler knows.) You wrote the following comments after the #include directive:

// this is a comment
/* and so is this */
/*
and so is this one
*/

The first comment is a one-line comment that uses the // characters. The second and third comments use the /* and */ characters to declare the beginning and end of the comments. The second comment uses the /* and */ character sets on the same line. By contrast, the last comment uses the /* and */ character sets to make a comment span multiple lines. C++ supports one-line comments that use the // and multiple-line comments that use the /* and */ characters.

After the comments, your listing shows the following source code:

main()
{
// the next statement displays a greeting message
cout << "Hello World!";

return 0;
}

The line main() declares the function main. Every program must have one and only one function main(). A function is a program component that performs some action that manipulates data. The function main() acts as the starting point where program execution begins. The contents of function main() vary depending on what the program does.

The function has a body of statements that is enclosed in a pair of open and closed braces (that is, the characters { and }). These braces define a statement block, which, in this case, makes up the function's body.

The function main() contains a one-line comment and two statements. Every statement ends with the semicolon character.

  • The first statement is an output statement. An output statement displays information on-screen to allow the program to communicate with you. The name cout is the standard console output object (a fancy-schmancy way for programmers to say the monitor), which sends characters to the screen (also called the output screen). The characters << represent the output operator, a special symbol that tells the object cout what to display. The characters "Hello World!" represent a literal text (that is, verbatim text) that appears on-screen when the program runs.
  • The second statement is return 0. This statement makes the function main() return 0, a numeric code that tells the operating system that the program ended on a happy note. All the programs in this book have the statement return 0 as the last statement in function main().

The following shows general syntax for a C++ program (note that the square brackets enclose optional program parts):

#include directives

[declarations]
[implementation of other functions]

main()
{
statements

return 0;
}

[implementation of other functions]

Keep in mind that comments may appear just about anywhere in the source code.

Lesson 1-5: Compiling and Linking Files

The Turbo C++ Lite environment allows you to compile and link the source code in the currently selected Edit window. The Compile menu offers the Compile, Link, and Make commands. The next subsections discuss these commands.

The Compile to OBJ command

The Compile to OBJ command compiles the contents of the currently selected Edit window. The environment displays a simple dialog box that lists the progress and statistics of compiling the source code. If the compiler detects errors or potential problems (related to possible errors that may creep up during run time), it displays the error and warning messages in the Message window.

The Compile to OBJ command compiles the source code to object code (the intermediate form); it does not produce the low-level machine language (the executable form). (See Lesson 1-1.)

The Link EXE file command

The Link EXE file command links the OBJ code generated by the compiler with the low-level library files and creates an EXE executable file. If the linker detects errors, it displays messages related to these errors in the Message window.

The Make EXE file

The Make EXE file command combines compiling and linking the source code. The Message window displays any error and warning messages generated by the compiler and/or linker. When you want to build a program from multiple .CPP source code files (that you type separately or obtain from a colleague), you apply the compiler to each source code file and then invoke the linker to combine the object form generated by the compiler for the separate source code files. This kind of compilation/linking is advanced and is beyond the scope of this book.

Lesson 1-6: Running Programs

The Turbo C++ Lite environment goes out of its way to simplify creating and running a program. The Run menu contains the Run command (which has the shortcut key combination Ctrl+F9), which compiles, links, and runs the source code in the currently selected Edit window. After you run the program and want to see the results, view the output screen by choosing Window-->User screen (the shortcut key combination for this command is Alt+F5).

The time has come to run your first C++ program! Follow these steps to compile, link, and run the file HELLO.CPP:

  1. Choose Run-->Run -- is there an echo in here? -- or press Ctrl+F9.

    This single command compiles, links, and runs the program.

  2. Choose Window-->User screen or press Alt+F5.

    This step displays the output screen, which contains the text Hello World!

  3. Press any key to return to the Turbo C++ Lite environment.

So what happens if you edit the source code by replacing the words "Hello World!" with the words "C++ is major cool!" and then press Ctrl+F9? The Turbo C++ Lite environment compiles, links, and runs the modified source code to display the message C++ is major cool! on the user screen.

Unit 1 Quiz

For each of the following questions, circle the letter for the correct answer.

  1. Every Edit window has a file associated with it; this file stores the contents of that window.
    A. True

    B. False
    • Your computer's CPU can understand and execute C++ source code files.
      A. True

      B. False

      • The Turbo C++ Lite environment supports only one Edit window at a time.
        A. True

        B. False

        • You can have multiple Edit windows selected at the same time.
          A. True

          B. False

          • When you press Ctrl+F9, you compile, link, and run the source code in the active Edit window.
            A. True

            B. False

Unit 1 Exercise

  1. Modify the source code in HELLO.CPP to include your own name in the first comment. Compile, link, and run the program. Notice that changing comments does not affect program execution.
  2. Modify the quoted text Hello World! to read Greetings from C++ Land! Compile, link, and run the program. Notice the new output message.
  3. Choose File-->Open to view .TXT files in the root directory of your computer (assuming that at least one such file exists). Type the *.TXT wildcard in the Name combo box to select .TXT files. Also click the ..\ item in the Files list box to move to the root directory.
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)