Write a program to read two English letters with a space between them. Then output these two characters in alphabetical order. The character is not case sensitive. If the user input a character that is not an English letter, give a warning.
#include <stdio.h>
int isAlpha(char a)
{
if (a >= 'a' && a <= 'z' || a >= 'A' && a <= 'Z')
return 1;
return 0;
}
void toLower(char *a)
{
if ('A' <= *a && *a <= 'Z')
*a = *a - 'A' + 'a';
}
int main(int argc, char const *argv[])
{
char a, b;
scanf("%c %c", &a, &b);
if (!isAlpha(a) || !isAlpha(b))
printf("input contains non-letter word!\n");
toLower(&a);
toLower(&b);
printf("%c %c", a > b ? b : a, a > b ? a : b);
};