Solved

# rounding question

Posted on 2004-11-30

I'm currently using microsoft visual c++ .net version 7.1.3088

I need to round a double value.

I tried the following code

stringstream ssConvert("");

// initially I retrieve the value from my class where it's a string

string tempStr = m_ColumnData.at(i);

double dblValue = atof(tempStr.c_str());

// now I try use Math rounding function

dblValue = Math::Round(dblValue, 2); // I need to round to 2 decimal places

ssConvert.precision(2);

ssConvert << dblValue;

m_ColumnData[i] = ssConvert;

When I compile, I get error C2653: 'Math' : is not a class or namespace name

I tried to

#include <cmath> or math.h and I'm getting the same compiler error.

Thanks in advance