Converts the supplied int32_t number (arg 2) to the textual equivelent and aggregates this to the supplied chain Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | SpeakNumber | (hzChain&,int32_t,) |
Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp
Function Logic:
Function body:
void SpeakNumber (hzChain& Z)int32_t nValue,
{
// Category: Text Presentation
//
// Converts the supplied int32_t number (arg 2) to the textual equivelent and aggregates this to the supplied chain
//
// Arguments: 1) Z Output chain aggregated by this operation
// 2) nValue The numeric value
//
// Returns: None
_hzfunc("SpeakNumber") ;
hzString v ; // To be returned
int32_t B ; // Billions
int32_t M ; // Millions
int32_t T ; // Thousands
int32_t U ; // Units (0-999)
if (nValue < 0)
{
Z << "Minus " ;
nValue *= -1;
}
B = (nValue / 1000000000);
M = (nValue % 1000000000)/1000000;
T = (nValue % 1000000)/1000;
U = (nValue % 1000);
if (B)
{
nValue -= (B * 1000000000);
_speakno(Z, B) ;
if (nValue)
Z << " billion, " ;
else
{
Z << " billion" ;
return ;
}
}
if (M)
{
nValue -= (M * 1000000);
_speakno(Z, M) ;
if (nValue)
Z << " million, " ;
else
{
Z << " million" ;
return ;
}
}
if (T)
{
nValue -= (T * 1000000);
_speakno(Z, T) ;
if (nValue)
Z << " thousand and " ;
else
{
Z << " thousand" ;
return ;
}
}
if (U)
_speakno(Z, U) ;
}