01:198:111 Lecture Notes - Lecture 10: Multiplication Table
01:198:111 verified notes
10/10View all
Document Summary
(!isvalid) is the same as (isvalid == false) (x>5) means x>5 is false. To do calculations with different variable types you have to cast the variable first. For example, if you have two integers but want a double answer you would write it as: double a = x/2. If x=5, then it would calculate 5/2 and a would be 2. 5. You could also make your answer a double by writing: double a = (double) x / 2. In this case, the division would be 5. 0/2 and give the answer of 2. 5. Additionally, if you have a double and cast it as an integer, it will cut off the decimal. For example: double a = 2. 5 (int) a = 2. One time actions such as set, read, display are 1 action. Each condition statement is an operation, so you count the if statement, while statement, do while statement each time the code runs it.