#include<stdio.h>
#include<string.h>
#define isdigit(x) ((x) >= '0' && (x) <= '9')
#define isupper(x) (((unsigned)(x) >= 'A') && ((unsigned)(x) <= 'Z'))
#define islower(x) (((unsigned)(x) >= 'a') && ((unsigned)(x) <= 'z'))
#define isalpha(x) (isupper(x) || islower(x))
#define toupper(x) (isupper(x) ? (x) : (x) - 'a' + 'A')
#define tolower(x) (isupper(x) ? ((x) - 'A' + 'a') : (x))
void StrToLower(char *str, int length)
{
int i;
for(i = 0 ; i < length; i++)
{
if (isupper((int)str[i]))
{
str[i] = (char )tolower(str[i]);
}
}
}
int main()
{
char a[]="HaPPY";
StrToLower(a, strlen(a));
printf("String = %s \n",a);
}
2016年7月6日 星期三
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言