EgtGeneral :
- Spostato nell'header il corpo di ToString per interi.
This commit is contained in:
@@ -20,34 +20,6 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string
|
||||
ToString( int nVal, int nPrec)
|
||||
{
|
||||
int nErr ;
|
||||
int nLen ;
|
||||
char szBuff[24] ;
|
||||
|
||||
|
||||
// eseguo conversione
|
||||
nErr = _itoa_s( nVal, szBuff, 10) ;
|
||||
|
||||
// se errore, ritorno stringa opportuna
|
||||
if ( nErr != 0) {
|
||||
_ASSERT( 0) ;
|
||||
return "#Error" ;
|
||||
}
|
||||
|
||||
// verifico lunghezza minima
|
||||
if ( ( nLen = (int) strlen( szBuff)) >= nPrec)
|
||||
return szBuff ;
|
||||
|
||||
// porto la stringa alla minima lunghezza
|
||||
string sBuff( szBuff) ;
|
||||
sBuff.insert( 0, ( nPrec - nLen), '0') ;
|
||||
return sBuff ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const string
|
||||
ToString( double dVal, int nPrec)
|
||||
|
||||
Reference in New Issue
Block a user