c言語大文字小文字変換


#define  _CRT_SECURE_NO_WARNINGS 
#include 
#include 
#include 
#include 
 
void tobig(char *p)
{
	while (*p != '\0')
	{
		if ((*p) >= 'a' && (*p) <= 'z')
		{
			*p = *p - ('a' - 'A');
		}
		p++;  //    
	}
}
 
void tosmall(char *p)
{
	while (*p != '\0')
	{
		if ((*p) >= 'A' && (*p) <= 'Z')
		{
			*p = *p + ('a' - 'A');
		}
		p++;  //    
	}
}
void main()
{
	char str[50] = "TASKLIST";
	char str2[30] = "calc";
    //scanf("");
	tobig(str2);
	printf("%s
", str2); tosmall(str); printf("%s
", str); system("pause"); return ; }