string line2 = "-89.75131467880756";
cout<<line2<<" <> ";
xcord = atof(line2.c_str());
cout<<xcord<<endl;
output -
-89.75131467880756 <> -89.7513
Question is ... how do i get it to desplay more precision.
string line2 = "-89.75131467880756";
cout<<line2<<" <> ";
xcord = atof(line2.c_str());
cout<<xcord<<endl;
output -
-89.75131467880756 <> -89.7513
Question is ... how do i get it to desplay more precision.
This should do it:
Code:#include <iostream> #include <iomanip> #include <string> using namespace std; int main (void) { double xcord; string line2 = "-89.75131467880756"; cout<<line2<<" <> "; xcord = atof(line2.c_str()); cout<<setprecision(16) << xcord<<endl; return 0; }
No No's:
fflush (stdin); gets (); void main ();
Goodies:
Example of fgets (); The FAQ, C/C++ Reference
My Gear:
OS - Windows XP
IDE - MS Visual C++ 2008 Express Edition
ASCII stupid question, get a stupid ANSI
Such a simple fix..... Thank you sooooo much =)