Unformatted text preview: - 0123 is handled as 83(10) [ie. 1*8*8+ 2*8 + 3] - display 83 !! Can also be represented as Octal values: 0.. [ Be careful: 0123 123 ] Common operators for numbers: +, -, *, /, % Precedence of *, /, and % are higher than + and -. Example: 3-2*4 gives -5 (* is calculated before -). Parentheses ( and ) can be used for more complicated calculations. Example: final_mark = (assignment_mark + (testA + testB)/2)/2 * 0.3 + exam_mark * 0.7; 2 special operators: ++ and --: increment and decrement a variable by 1. Example: count++; is the same as count = count + 1; and counter += 1; count--; is the same as count = count - 1; and counter -= 1;
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong http://www.cs.cityu.edu.hk/~helena 4. Program Structure III - 11 Data Types
The results could only be true / false (Boolean values) Meani...
View Full Document
This note was uploaded on 03/10/2012 for the course CS 1301 taught by Professor Dr.wong during the Winter '08 term at City University of Hong Kong.
- Winter '08
- Computer Programming