When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
18 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
what seems to be the problem exactly
"can't use" is a very vague statement
Im assuming you're having issue with the integer division
100/1 -> 100
100/2 -> 50
50/3 -> 16
16/4 -> 4
4/5 -> 0
it's doing integer division operations that round
maybe they are on windows and didn't include <functional>
which would be a compile error
on gcc iirc it compiles but then there's the whole integer division thing
include <functional>
yeah divides is in <functional> not <numeric>
;compile
#include<iostream>
#include<vector>
#include<numeric>
#include<functional>
int main() {
std::vector<int> terms{ 1, 2, 3, 4, 5 };
float eval = std::accumulate(terms.begin(), terms.end(), 100.F, std::divides());
std::cout << eval << std::endl;
return 0;
}
0.833333
request msvc_x64_latest or whatever
/solved
ermh, !solved? I don't remember
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity