+ 1
This is wrong answer in this c++ code......right is 5 but sololearn gives it wrong and give 4 output...
int a=3; int b=2; b=++a; cout<<++b; basic concept of C++ portion have this question but if we write 5 then it gives wrong... or if we write 4 the it gives correct Answer but this is wrong Right answer is 5 ......
4 Respostas
+ 8
I get 5 for the output when I run it like I expected.
https://code.sololearn.com/cyX1gz88Mqdg
+ 6
The following is the actual question:
What is the output of the following code?
int a=3;
int b=2;
b=a++;
cout<<++b;
+ 2
I found it, it is the last module quiz question of basic concepts in C++
However it says
b = a++
in the second last line.
This makes answer 4 correct, since b is assigned 3 if we use a++ instead of ++a
0
I didn't understand this completely. Is this problem somewhere in C++ lessons or does it happen when you run the code? The output indeed should be 5.