Hello,
For my homework I have to do about 14 functions and I have figured out all but two of them.
This one;
int toNumber( char c )
If the character passed in is a numeric digit, then the
integer value (not the ASCII code) of that digit is returned.
If the character is not a digit, -1 should be returned.
I have tried about 10 different things and can not seem to figure out
it either puts out c or some random number. Also I can not use isdigit unfort.
int toNumber (char ch)
{
char c = ch;
if(c>=48&&c<=57)
cout << 'c' << endl;
else
cout << '-1' << endl;
return 0 ;
}
And the other one i am having problems with.
bool isSpace( char c )
Returns true if the character passed in is a space. If it
is any other character, false is returned.
With vb.net I understand how to verify a space is being entered, but with C++ everytime I try to verify a space it looks at me like im stupid.
bool isSpace (char ch)
{
char c = ch;
if (isSpace(c)) c='\n'
{
return true;
}
else
{
return false;
}
}
Any help you can give would be greatly apprecaited
Thanks
Aaron