What's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with my code?

can someone explain why my code is coming out with an error? please be specific about what I need to change and why! https://code.sololearn.com/c07W0uy4tqat

23rd Apr 2018, 1:39 PM
Jackson Meddows
Jackson Meddows - avatar
6 Answers
+ 1
im not even good at c++ but this was easy,youre using cout without declaring its namespace,duh! you either use std::cout or declare using namespace std https://code.sololearn.com/cmrnauw8m39j/?ref=app
23rd Apr 2018, 1:54 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
0
What are you talking about? I legitimately can't figure out what's missing from the code. I just started learning C++ around 2 weeks ago.
23rd Apr 2018, 1:51 PM
Jackson Meddows
Jackson Meddows - avatar
0
Thank you, @Brains! See, Akib Reza, that wasn't so hard
23rd Apr 2018, 1:55 PM
Jackson Meddows
Jackson Meddows - avatar
0
@Brains why does it output 2324 instead of 2325? Isn't the code increasing each of the inputs by 1?
23rd Apr 2018, 1:57 PM
Jackson Meddows
Jackson Meddows - avatar
0
Not work like you think... Your static variable i "remember" last value setted (thanks to static modifier) but it reset for different template types because is like you defined 2 func functions (one for int type and on for double type) but this is maded by compiler and hided to programmer
23rd Apr 2018, 2:20 PM
KrOW
KrOW - avatar
0
Well namespace std was in there but I didn’t have the std::cout; in there
23rd Apr 2018, 2:22 PM
Jackson Meddows
Jackson Meddows - avatar