hi i just learned pointers kind of sort of, and the book gave me this example....
#include <iostream>
using std::cout;
using std::endl;
#include <cctype>
void convertToUppercase( char * );
int main()
{
char string[] = "characters and $32.98";
cout << "The string before conversion is: " << string;
convertToUppercase( string );
cout << "\nThe string after conversion is: "
<< string << endl;
return 0;
}
void convertToUppercase( char *sPtr )
{
while ( *sPtr != '\0' ) {
if ( islower( *sPtr ) )
*sPtr = toupper( *sPtr ); // convert to uppercase
++sPtr; // move sPtr to the next character
}
}
i guess this converts the string, characters and $32.98 to upper case, i was just wondering, how could i manipulate which characters get capitolized and which characters dont? just a question my book didnt cover![]()



LinkBack URL
About LinkBacks




