Int a=10 , b=10. What will be the output of??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Int a=10 , b=10. What will be the output of???

Cout<<a++<<b;

12th Oct 2017, 12:56 PM
Aman
Aman - avatar
5 Answers
+ 8
You can use ++a instead of a++ in given question to get output 1110.
12th Oct 2017, 1:22 PM
Lakshay
Lakshay - avatar
+ 7
Error: Cout was not declared 😃 int a,b=a=10; cout << a++ << b; Output : 1010
12th Oct 2017, 1:06 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 6
As Very_Hard(asm & js & c++ & java & py & (@Hard)) said you should write cout instead of Cout, and then output will be 1010. This is because a++ is post increment means value of a is first evaluated then incremented.If you write a++; cout<<a<<b; then output will be 1110.
12th Oct 2017, 1:16 PM
Lakshay
Lakshay - avatar
+ 2
Ya tnks bro
12th Oct 2017, 1:22 PM
Aman
Aman - avatar
+ 1
Ya I also thought that it would be 11 10
12th Oct 2017, 1:18 PM
Aman
Aman - avatar