+ 1

I dot get it please help

I dot get it please help x++ and ++×

18th Nov 2016, 11:06 AM
ozoromo
ozoromo - avatar
6 odpowiedzi
+ 4
++x is called preincrement while x++ is called postincrement for instance int x = 5, y = 5; Console.WriteLine(++x) Console.WriteLine(x) Console.WriteLine(y++) Console.WriteLine(y)
18th Nov 2016, 11:18 AM
Madhab Dhakal
Madhab Dhakal - avatar
+ 4
in x++ value of x is increased after the operation. for example:let x=4 y=3+x++ then the value of y will be 7 in ++x value of x increased before the operation. for example:let x=4 y=++x+3 here value of y is 8
18th Nov 2016, 12:40 PM
sanket jain
sanket jain - avatar
+ 1
Real world example: We're making apple pies in which each apple pie requires 8 apples. We can't just shove whole apples into a pie, we should wash the apple, peel and cut the apple, and ensure we don't add too few or too many apples to ruin our recipe. So my method of cooking would be washing, peeling and cutting the apples. While using ++x or x++ to count each apple for accuracy. If I were to count each apple before I did the above method I would use: ++x. Else I'd do the method first and then count each apple: x++.
22nd Nov 2016, 11:40 PM
Nightfury
Nightfury - avatar
0
++x is pre increment means first increase the value then update the value x++ is post increment means first update the value then increase the value int x=5,y; x++; y=x; cout<<y; //5 x=5 ++x; y=x; cout<<y; //6
18th Nov 2016, 2:10 PM
Dhruv Saxena
Dhruv Saxena - avatar
0
postfix and prefix , when you have x++ the instruction will work and then x will receive x+1 , in ++x , x will be incremented by 1 and the instruction will work with the new x value
24th Nov 2016, 3:35 PM
achraf
achraf - avatar
- 1
hi
25th Nov 2016, 6:53 PM
scavengercsgo
scavengercsgo - avatar