Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case change in C++ (Mingw )

Status
Not open for further replies.

inus

Technical User
Joined
Jun 4, 2003
Messages
2
Location
SG
I am new at programming and are having a hard time with C++ using Cohoon& Davidson as a guide. Can anybody recommend a good handbook for C++.

How would I change a the case of a string from Uppercase to Lowercase and vice versa.

Thank you
 
Code:
void ChangeCase ( char *s )
{ 
  if ( s == NULL )
     { return; }
  DWORD cbString = strlen ( s );
  char *c;
  for ( DWORD i1 = 0; i1 < cbString; i1++ )
     { c = s + i1;
       if ( *(c) >= 'A' && *(c) <= 'Z' )
          { *(c) += 32; } else
          { if ( *(c) >= 'a' && *(c) <= 'z' )
               { *(c) -= 32; } } } }


Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top