GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Source-Code-from-Tutorials/C++/21_cppBeginners.cpp at master · isNan909/Source-Code-from-Tutorials Expand file tree/ Copy path21_cppBeginners.cppMore file actions 42 lines (29 loc) · 1.04 KB / Copy path21_cppBeginners.cppFile metadata and controls42 lines (29 loc) · 1.04 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 #include <iostream> using namespace std; int main() { int a = 10, b = 10, c = 10, d = 10, e = 10, x; a += 5; // is the same as a = a + 5; cout << a << endl; b -= 5; // is the same as b = b - 5; cout << b << endl; c *= 5; // is the same as c = c * 5; cout << c << endl; d /= 5; // is the same as d = d / 5; cout << d << endl; e %= 3; // is the same as e = e % 3; Modulus Operator (%) - divides the values and than returns the remainder - 10 % 3 = 1 cout << e << endl; // increment operators x = 20; cout << x++ << endl; // first it prints the value than it will increment x - 20 cout << x << endl; // 21 x = 20; cout << ++x << endl; // increments first and than it will print the value of x - 21 cout << x << endl; // 21 x = 20; cout << x-- << endl; // first it prints the value than it will decrement x - 20 cout << x << endl; // 19 x = 20; cout << --x << endl; // decrement first and than it will print the value of x - 19 cout << x << endl; // 19 } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |