Practice exercise -- Allocating memory Storing data into memory: 1. Instruct computer to allocate memory 2. Invoke program statements to put data into allocated memory Constant: A memory location whose value may not be changed: const dataType IDENTIFIER = value; Variable: Memory location that may be changed dataType identifier1, identifier2, ..., identifierN; Storing data: 1. Store with an assignment statement: identifier = expression; 2. Store through an input statement cin >> variable; Printing (stored) data: cout << variable; Statement Show identifier name and value (or error) -------------------------------- ----------------------------------------- 1. int a, | b = 2; | a = b; | 2. int x = 3, y = 4; | y + 5 = x * 3; | 3. double inches = 0.0; | inches = 6.0; inches = inches + inches; | 4. const int E = 5; | 5. double x = -5.5, y = 17.5; | int d = 4; y = d - x + y; | 6. int n; | cin >> n; // 1.23 entered | 7. int count = 0; | cout << count; | cout << count++; cout << ++count; |