You can use c string instead of std::string if you want.
Anyways in your original code you should get rid of the while on line 30 and make it an if statement then get rid of the , loc not sure what that is also to upper returns an integer and takes 1 integer as param.
Basically here is how the toupper function looks like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int toupper( int c )
{
if( c >= 'a' && c <= 'z' )
return( c - ' ' );
return( c ); //else return orig value
}
//or
int toupper( int c )
{
if( c >= 97 && c <= 122 )
return( c - 32 );
return( c ); //else return orig value
}
@giblit
Yes you can see what elements they are in that example but I was thinking in more general terms for correcting capitalization. Instead of fixing "the fox" now I have a method that works on more than that if I would need it.
Ah yeah that would be more practical to be honest I didn't even realize he was trying to make it camel case. I just though he randomly picked those two elements.
OP wrote:
How would I capitalize the first and fifth element of "the fox" using toupper.