O'Reilly logo

Ivor Horton's Beginning Visual C++ 2013 by Ivor Horton

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 3Decisions and Loops

  • How to compare data values
  • How to alter the sequence of program execution based on the result
  • How to apply logical operators and expressions
  • How to deal with multiple choice situations
  • How to write and use loops in your programs

You can find the wrox.com code downloads for this chapter on the Download Code tab at www.wrox.com/go/beginningvisualc. The code is in the Chapter 3 download and individually named according to the names throughout the chapter.

COMPARING VALUES

Unless you want to make decisions on a whim, you need a mechanism for comparing things. This involves some new operators called relational operators. Because all information in your computer is ultimately represented by numerical values (in the last chapter you saw how character information is represented by numeric codes), comparing numerical values is the essence of all decision making. You have six operators for comparing two values:

< less than <= less than or equal to
> greater than >= greater than or equal to
== equal to != not equal to

Each operator compares the values of two operands and returns one ...

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