guess the value of each of the following and explain your logic.
int x=5;
cout<< x++ + ++x<<endl;
x=5;
cout<< ++x + x++<<endl;
x=5;
cout<<++x + ++x<<endl;
x=5;
cout<<++x + ++x + ++x<<endl;
# | User | Rating |
---|---|---|
1 | jiangly | 3977 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3483 |
8 | hos.lyric | 3381 |
9 | gamegame | 3374 |
10 | heuristica | 3358 |
# | User | Contrib. |
---|---|---|
1 | cry | 170 |
2 | -is-this-fft- | 162 |
3 | Um_nik | 161 |
4 | atcoder_official | 159 |
5 | djm03178 | 157 |
6 | Dominater069 | 156 |
7 | adamant | 154 |
8 | luogu_official | 152 |
8 | awoo | 152 |
10 | TheScrasse | 147 |
c++ is amazing
guess the value of each of the following and explain your logic.
int x=5;
cout<< x++ + ++x<<endl;
x=5;
cout<< ++x + x++<<endl;
x=5;
cout<<++x + ++x<<endl;
x=5;
cout<<++x + ++x + ++x<<endl;
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en3 | virgil_van_maguire | 2025-01-06 14:29:07 | 41 | |||
en2 | virgil_van_maguire | 2025-01-06 14:15:28 | 44 | Tiny change: 'x<<endl;\n' -> 'x<<endl;\n x=5;\n cout<<++x + ++x + ++x<<endl;\n' | ||
en1 | virgil_van_maguire | 2025-01-06 14:12:58 | 218 | Initial revision (published) |
Name |
---|