Oct 6, 2017 at 6:01am UTC
Bear with me here guys as I am dumping a lot of codes. Hopefully you guys are feeling generous and check it out to help a brother out. Any help would be greatly appreciated!
Last edited on Oct 9, 2017 at 5:49pm UTC
Oct 6, 2017 at 6:38am UTC
What's wrong with C++'s
<random>
? Simple C rand is a pretty weak rng, even if you juggle it a little.
About your error, it is pretty self explanatory, you need to define a conversion operator for your custom Double to POD double.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <iostream>
#include <string>
struct String
{
std::string str;
operator float () const
{
return std::stof(str);
}
};
int main()
{
String s{ "1010" };
float no = s;
std::cout << no;
return 0;
}
Outputs
Last edited on Oct 6, 2017 at 6:39am UTC
Oct 6, 2017 at 6:46pm UTC
Okay, forget the error I was having trouble with. I think I fixed it.
As of now I have another problem.
Last edited on Oct 9, 2017 at 5:50pm UTC
Oct 7, 2017 at 5:53pm UTC
I'm afraid we need a compilable or nearly compilable code to help you. It's really hard to guess all the missing part.
Oct 7, 2017 at 6:37pm UTC
Sorry about that. I'm gonna edit it so it compiles. Thanks for pointing that out.