Download presentation
Presentation is loading. Please wait.
Published byAudra Williamson Modified over 9 years ago
1
C ONTINUING C++ Precedence Rules, Numeric Types, More Operator Symbols, and Keyboard Input Prompts.
2
P RESEDENCE R ULES The mathematical order of operations determine to rules for C++ Highest Precedence Parenthesis Exponents Multiplication, Division, Modulus Addition, Subtraction Lowest Precedence
3
N UMERIC T YPES Variable TypeWhat it does int Takes only the whole number entered, disregards decimals float Takes into account not only the whole number, but also its decimal values If int is used on a variable equaling 10.66, the program sees that variable as the number 10 If float is used on the variable 10.66, the program will see that variable as 10.66
4
M ORE O PERATOR S YMBOLS OperatorMeaning + Addition - Subtraction * Multiplication / Division % Modulus (remainder from integer division) Be careful with the order of operations!
5
M ODULUS Modulus is the remainder you obtain from division For Example: 20 / 3 = 6 with a remainder of 2, thus 2 would be the answer for 20 % 3. What would be the answer to 3 * 5 % 6 ? What about to 5 + 9 / (3 % 2) ?
6
CIN cin is a variable that denotes an input stream The operator << is also called an insertion operator, it follows the cin variable and is followed by where you want the variable to go into For Example: Cin >> inches; Note: The program will wait for a value to be inputted after the cin prompt, after you enter what the program is asking for, press enter.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.