what does x++*y-- mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what does x++*y-- mean?

3rd Oct 2016, 3:23 AM
Steven Cai
Steven Cai - avatar
14 Answers
+ 34
Try this example to understand better ;) int main() { int x=10; int y=2; cout<< x++*y--; }
3rd Oct 2016, 10:24 AM
Emma
Emma - avatar
+ 11
x++ is postfix increment and y is postfix decrement, postfix means the values of x and y will be used first in the expression after that increment/decrement operation will be applied. eg : int x=5,y=4; int z=x++*y--; //value of z will be 20 (5*4) //value of x will be 6 and value of y will be 3
3rd Nov 2016, 3:26 AM
Akshay Kapoor
Akshay Kapoor - avatar
+ 6
calculate x * y and increase x, decrease y.
3rd Oct 2016, 6:36 AM
kiwiyou
kiwiyou - avatar
+ 2
++ and -- are unary operators which help in increasing or decreasing the value by one. If x is the operand in an statement and if the ++or-- are placed before the operand then the value of x will first get changed and then it will be kept in the statement and if the operators are after the operand then the value will first be kept in statement and then it will be changed. eg- If x=5 and y=4 and c=++x-y then c=6-4=2 while if c=x++-y then c=5-4=1but after this the value of x will be 6
7th Nov 2016, 11:35 AM
Harshit Upadhyay
Harshit Upadhyay - avatar
+ 1
first will be using in expression, after that post incrementation and post decrementation : example for explanation post and pre (increment and decrement value) int a = 5; int b = 5; int c = 5; int d = 5; cout<<" a++ = "<< a++ <<"\nb-- = "<< b-- <<"\n++c = "<< ++c <<"\n--d = "<< --d ; /* displayed expression result: a++ = 5 b-- = 5 ++c = 6 --d = 4 different case is with "pre" incrementation/decrementation . First we have to calculate experience and after that use it*/ cout<<"a = "<< a <<"\nb = "<< b <<"\nc = "<< c <<"\nd = "<< d; /*displayed values after using expressions result: a = 6 b = 4 c = 6 d = 4 I used "\n" == it mean "new line" */ so: a++*b-- , a--*b++... /* or other combination will be in result = 25 */ // sorry for my english :)
7th Aug 2017, 8:23 AM
electron
electron - avatar
0
it will first use the values of x and y as like it gets from the user and for the next looping the value of x will increase by 1 and y value will decrease by 1 this is the example for post increment and pre decrement concept
19th Feb 2017, 12:24 PM
G.Madhu priya
0
Please type in a code to print to the screen the value of x divided by y. int x = 81; int y = 3; ______<< x ________ y << endl ;
26th Jun 2018, 11:11 AM
Md Eyasin Ali
Md Eyasin Ali - avatar
0
x++ is a shortened way of saying x + 1, and y-- is a shortened way of saying y - 1. So x++*y-- would mean (x + 1) * (y - 1). For example, if x was 5 and y was 3, x++*y-- would be 12, because 5 + 1 is 6 and 3 - 1 is 2. 6 * 2 is 12.
22nd Jul 2022, 2:28 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
- 2
Please type in a code to print to the screen the value of x divided by y. int x = 81; int y = 3; << x y << endl;
23rd Feb 2017, 7:18 AM
Ahmed Bashir Anour
- 2
Please type in a code to print to the screen the value of x divided by y. int x = 81; int y = 3; ______<< x ________ y << endl ;
23rd Feb 2017, 7:20 AM
Ahmed Bashir Anour
- 3
X++ = x+1 y-- = y-1 Lets x=4 and y=3 If there Is no loop. Then, Answer will be (4++)*(3--)=12 As post increment used. Afterward i'll give you - > 10, 6, 0, - 8 and so on
6th Jan 2017, 4:24 AM
shailesh kumar
shailesh kumar - avatar
- 5
Please type in a code to print to the screen the value of x divided by y. int x = 81; int y = 3; << x y << endl;
23rd Feb 2017, 7:18 AM
Ahmed Bashir Anour
- 6
x+1=11 as the new value of x post fixing.... but y- is nothing y remains as 2.... 11*2=22 is that the correct answer????? Emma
9th Dec 2016, 10:00 PM
Az ad
Az ad - avatar
- 9
Emma what's your Facebook?
31st Dec 2016, 8:11 PM
CFT_EXTREME