|
Compound OperatorsC++ uses several special operators called compound operators. These operators provide a shortcut to writing out longer statements such as:x = x + 5 C++ allows you to say the same thing by typing:You don't absolutely have to use the compound operators, they just make your job easier by giving you less to type. Here's a table: compound operator Example the Long WayYou do need to be careful when using compound operators because the order of precedence is less for them (see page 75 and Appendix B of your Knowlton book). Assignment Write a program that will calculate the sales tax(8%)for an item given by the user. Store the answer in a variable named the_tax. Use compound operators to solve the problem. |