C++ By Example 二 精彩文摘
Using C++ Math Operators and Precedence
If you are dreading this chapter because you don’t like math—relax,C++ does all your math for you! It is a misconception that you have to be good at math to understand how to program computers. In fact, programming practice assumes the opposite is true! Your computer is your “slave,” to follow your instructions, and to do all the calculations for you. This chapter explains how C++ computes by introducing you to
o Primary math operators
o Order of operator precedence
o Assignment statements
o Mixed data type calculations
o Type casting
Chapter 8 o Using C++ Math Operators and Precedence
Many people who dislike math actually enjoy learning how the computer handles it. After learning the math operators and a few simple ways in which C++ uses them, you should feel comfortable using calculations in your programs. Computers are fast, and they can perform math operations much faster than you can!
C++’s Primary Math Operators
A C++ math operator is a symbol used for adding, subtracting,multiplying, dividing, and other operations. C++ operators are not always mathematical in nature, but many are. Table 8.1 lists these operator symbols and their primary meanings.
......
→→→→→→→→→→→→→→→→→→→→查找获取
评论