#include
#include
int
main( int argc, char *argv[] )
{
printf( "Input a charactor :\n" );
while( 1 ){
int c;
//printf( "Input a charactor :\n" );
c = getchar();
if ( isupper( c ) ){
putchar( tolower( c ) );
putchar( '\n' );
}
else if( islower( c ) ){
putchar( toupper( c ) );
putchar( '\n' );
}
}
return ( 0 );
}
直接利用库函数就好了!
#include
using namespace std;
int main()
{
char a;
cin>>a;
if(a>='a' && a<='z')
{
a = a-32;
}
else if(a>='A' && a<='Z')
{
a= a+32;
}
cout< return 0;
}