M
Mike Copeland
I have the following (rather simple, I think) code which compiles but
executes in a bizarre way: the code in the subprogram is skipped when
called. 8<{{
Here's the code and the call to it I use:
string spellNumber(double value)
{
bool showThousands = false;
bool allZeros = true;
int ii, dPos, nn;
char wc;
string digits, temp;
ostringstream ossw;
static string builder;
ossw.str("");
ossw << value;
digits = ossw.str();
dPos = digits.find('.');
if(dPos != string::npos) digits.erase(dPos);
nn = digits.length();
wc = digits.back();
for(ii = digits.length()-1; ii >= 0; ii--)
{
int ndigit = (int)(digits[ii]-'0');
int column = (digits.length()-(ii+1));
} // for
// more code to be added here
return builder;
}
....
spellNumber(123.45); // call the function
I have, of course the normal stdafx.h header and "use namespace
std;", and this is code from a small test program I use to debug new
functions and such. Many other programs and many thousands of lines of
code work fine, but this code is weird...and I can't see what's wrong
with it!
Please advise... TIA
executes in a bizarre way: the code in the subprogram is skipped when
called. 8<{{
Here's the code and the call to it I use:
string spellNumber(double value)
{
bool showThousands = false;
bool allZeros = true;
int ii, dPos, nn;
char wc;
string digits, temp;
ostringstream ossw;
static string builder;
ossw.str("");
ossw << value;
digits = ossw.str();
dPos = digits.find('.');
if(dPos != string::npos) digits.erase(dPos);
nn = digits.length();
wc = digits.back();
for(ii = digits.length()-1; ii >= 0; ii--)
{
int ndigit = (int)(digits[ii]-'0');
int column = (digits.length()-(ii+1));
} // for
// more code to be added here
return builder;
}
....
spellNumber(123.45); // call the function
I have, of course the normal stdafx.h header and "use namespace
std;", and this is code from a small test program I use to debug new
functions and such. Many other programs and many thousands of lines of
code work fine, but this code is weird...and I can't see what's wrong
with it!
Please advise... TIA