GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Source-Code-from-Tutorials/C++/21_cppBeginners.cpp at master · isNan909/Source-Code-from-Tutorials

Expand file tree

/

21_cppBeginners.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (29 loc) · 1.04 KB
/

21_cppBeginners.cpp

Copy path

File metadata and controls

42 lines (29 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.