So i wanted to make a calculator so i did int << a = 5; int << b = 10; int sum a + b = 15; but it didnt work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So i wanted to make a calculator so i did int << a = 5; int << b = 10; int sum a + b = 15; but it didnt work

help n what did I did wrong

28th Dec 2016, 6:05 PM
RadGuy4Life
RadGuy4Life - avatar
1 Answer
+ 5
How you should write it should be something like int a = 5; int b = 10; int sum = a + b; If you then output the sum you will see that it is 15. Keep in mind that in C++ the '=' is an assignment operator and assigns everything on the righ thand side to a variable on the left hand side, if it is acceptable by the compiler.
28th Dec 2016, 6:08 PM
Greg Ortiz
Greg Ortiz - avatar