輸入一個大寫或者小寫,輸出其相反的大小寫。

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include "main.h"


int main()
{
	//輸入一個大寫或者小寫,輸出其相反的大小寫。
	char a;
	int d;
	printf("輸入一個大寫或者小寫字符:\r\n");
	a = getchar();
	if(a >= 'a' && a <= 'z')
	{
		a= a- ('a'-'A');
	}else
	{
		a=a+('a'-'A');
	}
	printf("變換字符大小寫:%c,%d\r\n",a,a);
	system("pause");
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章