Hi dears
I have trouble in this below question I want to know how that answer come:
#include<iostream.h>
#include<conio.h>
void main()
{
int x=20,y=35;
clrscr();
x=y++ + x++;
y=++y + ++x;
cout<<x<<y;
getch();
}
when I run this program I get this answer = 5794.
I can't understand how it come, when I solve one Individual line [ x=y++ + x++; ] like this
#include<iostream.h>
#include<conio.h>
void main()
{
int x=20,y=35;
clrscr();
x=y++ + x++;
cout<<x;
getch();
}
I get answer = 56 and when I solved this Individual Line [ y=++y + ++x; ] like this
#include<iostream.h>
#include<conio.h>
void main()
{
int x=20,y=35;
clrscr();
y=++y + ++x;
cout<<y;
getch();
}
I get answer =57 I know the basic principle of prefix & postfix increment in c++ and in my solution the answer should come 5657 instead of 5794 when we solve this full program
#include<iostream.h>
#include<conio.h>
void main()
{
int x=20,y=35;
clrscr();
x=y++ + x++;
y=++y + ++x;
cout<<x<<y;
getch();
}
Please explain how & why the answer comes 5794?