I was trying to develop the function get_number for when I PRESS ENTER it return 0 and when it returns 0 close the program, but when I press enter it doesn't return 0 and still asking me for a number. can someone tell me what is the error in the function get_number()?
To use std::stod, you need to compile with C++11 compatibility (on GCC or Clang, use -std=c++11). Keep in mind that your compiler might not support std::stod, but all modern compilers should (C++11 has been the standard for more than 2 years now).
Thank NT3 for your answer but about what you said, isn't it the same to use atof and atod? and I am compiling with c++, what you wrote is in c code right? because I just read a lil bit of c and it was like that.
Other way round... :)
C-Style strings are used in C, and the headers you are using (cstdlib, cstring and cmath) are all C headers (see the 'c' at the front of the names?). C++ uses the STL, examples of which are iostream, string and vector. atof is a C function for converting C-style strings (char arrays) to a floating point number.