Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>oh ok...so 4.89281e+07 is 48,928,100 ?
Well, it takes a bit of work to do the commas, but let's see:
#include <iostream>
#include <locale>
#include <string>
using namespace std;
class numfmt: public numpunct<char> {
string do_grouping() const { return "\3"; }
char_type do_thousands_sep() const { return ','; }
};
int main()
{
cout.imbue ( locale ( locale(), new numfmt ) );
cout<< fixed << 4.89281e+07 <<endl;
}
Yep, sure seems that way. ;)
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Well, if you want to force precision, add the blue line:
#include <iostream>
#include <math.h>
using namespace std;
double xyz[3];
double mark[3];
void markoff(double x, double y, double z)
{
mark[0] = y;
mark[1] = z;
mark[2] = ((3*y*z) - x);
cout<<"x = "<<mark[0]<<" y = "<<mark[1]<<" z = "<<mark[2]<<endl;
}
int main()
{
xyz[0] = 1;
xyz[1] = 1;
xyz[2] = 1;
cout.setf ( ios::fixed, ios::floatfield );
while( mark[2] < (pow(10.0,101.0)) )
{
markoff( xyz[0], xyz[1], xyz[2] );
xyz[0] = mark[0];
xyz[1] = mark[1];
xyz[2] = mark[2];
}
return 0;
}
But you'll probably just get a ton of zeros instead of anything useful.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401