+ 3
How to use std::stod() properly?
I recently tried using std::stod for the code below, but I always get this error message: "stod is not a part of std". Since I am somewhat sure Sololearn's compiler features C++11, I can't find my mistake. Any help would be appreciated :) https://code.sololearn.com/cgA89VEpQiFZ/?ref=app
14 Antworten
+ 11
Thanks Andrea
In addition to Andrea's alternative solution, I found a second alternative to this problem by using stringstream facilities.
[https://stackoverflow.com/questions/16747915/c-converting-a-string-to-double]
[https://code.sololearn.com/cjY4VyCIUkVc]
+ 10
For showing that f is really a double! :)
+ 9
Useful as hell!
Soon I wanna implement a log system for my projects using this tutorial.
[http://www.drdobbs.com/cpp/logging-in-c/201804215]
+ 9
I'm so glad to find it useful. Good luck to you and dear Andrea.
@~)~~~~
+ 8
This one isn't as good as Andrea's but not bad! ;)
https://code.sololearn.com/cn62B9g73skE
+ 3
...std::stod is only available if you are at least using std=c++11 to compile...
Seems that sololearn don't use c++11. I got similar problem using to_string();
+ 3
try something using this
http://www.cplusplus.com/reference/cstdlib/strtod/
+ 3
Not a perfect code, only for give an idea but now using strtod seems to work!
https://code.sololearn.com/cKmafkv7FgO6/?ref=app
+ 2
Thanks for all the suggestions and tipps.
As a result, I could complete the code, and can now have a deeper look in what you gave me.
Always good to learn something new!
+ 1
why + 1.0?
anyway good solution
+ 1
Ah okey!
+ 1
stringstream are really useful XD
+ 1
You're welcome :D
+ 1
You too Babak