Online Time 10/8 Topics *** NO OFFICIAL NOTICE OF CAMPUS CLOSURE YET *** Questions / Requests 1. Example: quadratic equation *** These are topics that would normally be discussed in the classroom lecture *** 2. Compound assignment operators 3. Increment and decrement operators 4. Formatted output -------------------------------------------- += int x = 3, y = 2; //x + y //x = x + y; x += y; // x is 5 and y is 2 x *= 2; // x is 10 x -= 3; // x is 7 x /= 3; // x is 2 x += 7; // x is 9 x %= 4; // is 1 ------------------------------------ int seconds = 57; seconds += 1; seconds %= 60; seconds += 1; seconds %= 60; seconds += 1; seconds %= 60; a + b => the sum is stored in stack memory c += d => the sum of c and d is stored in stack memory. then that memory location is copied into c --------------------------------------- Increment operator only operator on integer types (int, long, short, unsigned, char, ...) int i = 6; cout << i << endl; // 6 i++; // postfix increment operator cout << i << endl; // 7 i += 1; i = i + 1; ++i; // prefix increment operator Decrement operator only operator on integer types int i = 6; cout << i << endl; // 6 i--; // postfix decrement operator cout << i << endl; // 5 i -= 1; i = i - 1; --i; // prefix decrement operator -------------------------------- non-parameterized manipulator endl boolalpha setw is a parameterized manipulator