I'm trying to convert my C# class library over to C++ and was wondering if this is how scientific notation should look. Any pointers would be nice.
// Scientific Notation?
private int i = 0;
private string Sign = "";
public string Output = "";
public void Sci(double x)
{
if (x > 1)
{
for (int p = 0; x > 10.0f; p++)
{
i = p;
x /= 10.0f;
}
Sign = "";
}
else if (x < 1)
{
for (int p = 0; x < 1; p++)
{
i = p;
x *= 10.0f;
}
Sign = "-";
}
Output = x->ToString() + " * 10^(" + Sign + i->ToString() + ")";
}