Chapter 1. Expressions and Variables

At heart, a computer is a machine for doing arithmetic and making decisions very fast, and a computer language is a precise way to give instructions to such machines. The simplest kind of C++ statement is an expression, which is similar to a mathematical expression, although a C++ expression is modified because it is hard to type square root signs and other mathematical symbols. I am going to introduce C++ expressions to you using the UnderC system; after you have installed the accompanying software, an UnderC icon will appear on your desktop. When you execute this program, a plain window will appear with a ;> prompt. At this point, you can type any valid C++ statement, and it will immediately be evaluated.

In this chapter you will learn

  • How to write common arithmetic expressions in C++

  • How to declare and use variables

  • The difference between floating-point and integer numbers

  • How to manipulate text strings

  • How to do input and output

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.206.254