|
#include "StdAfx.h"
#include <assert.h>
int CharToNumber( TCHAR c )
{
assert( c >= 48 && c <= 57 );
return c-48;
}
TCHAR NumberToChar( int d )
{
assert( d >= 0 && d <= 9 );
return d+48;
}
int StringToNumber( _tstring s )
{
_tistringstream ss( s );
int n;
ss >> n;
return n;
}
_tstring NumberToString( int n )
{
_tostringstream oss( _tostringstream::out );
oss << n << std::ends;
return oss.str();
}
/*
_tstring NumberToString( double d )
{
_tostringstream oss( _tostringstream::out );
oss.setf(std::ios::fixed);
oss.precision(4);
oss << d << std::ends;
return oss.str();
}
*/
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.