-
2.0e1.0 to 20.0
need help converting an outputed double from 2.0e1.0 to 20.0!!!
on a mac it would simply be cout << ... << fixed << showpoint << setprecision(1) << 20;
but when i do that in VC++ it tells me fixed and showpoint are unidentified identifiers
plz help!!!
thanks!!
-
here's a sample of code that doesnt work:
#include <iostream.h>
#include <iomanip.h>
int main() {
cout << fixed << showpoint << setprecision(2) << 200;
return 0;
}
VC++ will give me a compiling error of:
fixed unidentified identifier
showpoint unidentified identifier
but then if i do:
cout << setprecision(2) << 200;
it will output:
2.0e+2
how can i make it so it outputs:
200.00
?
thanks in advance!!
-
Code:
using System;
class DoubleOut
{
public static void Main()
{
double x = 2.0e2;
Console.WriteLine("Number equals "+x);
}
}
One version with C#
-
Maybe go with C on this:
double num = 2e2;
printf("Number is %.2lf", num);
-
use the new headers instead of the old so...
#include<iostream>
#include<iomanip>
using namespace std;
.
.
.