A
Arash_89
Guest
Hello,
In the first code in C++, I expected 27 and it's true and in C# is 26.(I'm understand and I'm fine with this output in C# and C++)
But main problem here:
Why in the third code in C++ we have 24? I expected it was 22. (In C# y is 22 and I'm fine with this output)
Thank in advance
void main()
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x) + x++;
cout << y ; // y is 27 and it's OK
}
}
public static void Main(String[] args)
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x) + x++;
Console.WriteLine; //It's OK.
}
}
void main()
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x);
cout << y ; // 24 and I expected 22 ??
}
}
public static void Main(String[] args)
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x);
Console.WriteLine; It's 22 and It's OK.
}
}
Continue reading...
In the first code in C++, I expected 27 and it's true and in C# is 26.(I'm understand and I'm fine with this output in C# and C++)
But main problem here:
Why in the third code in C++ we have 24? I expected it was 22. (In C# y is 22 and I'm fine with this output)
Thank in advance
void main()
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x) + x++;
cout << y ; // y is 27 and it's OK
}
}
public static void Main(String[] args)
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x) + x++;
Console.WriteLine; //It's OK.
}
}
void main()
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x);
cout << y ; // 24 and I expected 22 ??
}
}
public static void Main(String[] args)
{
{
int x = 2;
int y = (5 * x++) + (3 * ++x);
Console.WriteLine; It's 22 and It's OK.
}
}
Continue reading...