+ 5
Why isn't this code working though it was working perfectly earlier ???
Here is a code to calculate mean of element stored in a vector data. float mean= 0.0; for (int index=0; index <data.size();index ++) mean = mean + (data[index])/data.size(); At first it gave correct values for mean but don't know why it gives back 0 as result now.
3 Antworten
+ 8
Thanks Duc Van Khanh Tran
I copied the code to another compiler and it worked
Thanks
+ 1
I think you should write the whole code again on another page. I had similar problems (even though I'm using a different language), and I had to write down the whole code again (not just copy and paste) on another page like... twice or three times, and it worked perfectly again. I know it's tiring but try to bear with it... I hope that helps you.
+ 1
+Junaid Siddiqui
Just copy and paste?! You’re so lucky!!😂