60 likes | 138 Views
CIS 451: Order of Operations. Dr. Ralph D. Westfall January, 2009. Program Development. write code 1st, then analyze requirements? faster “progress” at start slower finish “messier” code when done analyze requirements, then write code slower at start, better in long run
E N D
CIS 451: Order of Operations Dr. Ralph D. Westfall January, 2009
Program Development • write code 1st, then analyze requirements? • faster “progress” at start • slower finish • “messier” code when done • analyze requirements, then write code • slower at start, better in long run • "Pay me now, or pay me later!"
Order of Operations • ( ) items in parentheses evaluated 1st • ^ then exponentiation • *, / then multiply, regular division • \ then integer division • MOD (modulus: remainder after divide) • then +, - plus, minus • Please Excuse My Dear Aunt Sally
Order of Operations - 2 • comparison operators come after calculations • =, < >, <, >, <=, >= • logical operators come after comparisons • NOT, AND, OR (in this order)
Operations Order Exercises • evaluate the following (in class): • 3 * 5 + 4 / 2 – 3 ^ 3 • If (9 + 2) = (7 + 4) Then ... • try to create problems hard to do right • PEMDAS; and include Boolean comparisons • <= 8 single digits in problem • answer has <= 1 decimal • intermediate values <= 20 • post in Blackboard, verify in Excel
String Constants for Non-HTML Output • VBCrLf: carriage return and line feed • moves following text to start of next line • Response.Write "Hello" & VBCrLf & "world" • VBTab - inserts a tab • use " " (1 or more spaces in quotes) to insert one space in HTML output) • Note: HTML ignores extra spaces unless you use <p>J Lo shows J Lo on web page <p>J Lo shows J Lo