程式作業 第4題 for 四子一丙
#include <stdio.h> #include <stdlib.h> int main(void) { char cstring1 ,cstring2; printf("輸入一個字元: "); cstring1 = getchar(); if(cstring1 <= 90 && cstring1 >= 65) { cstring2 = cstring1 - 65; cstring2 = 97 + cstring2; printf("輸入的字元是大寫%c 轉小寫為%c\n", cstring1, cstring2); } else if(cstring1 <= 122 && cstring1 >= 97) { cstring2 = cstring1 - 97; cstring2 = 65 + cstring2; printf("輸入的字元是小寫%c 轉大寫為%c\n", cstring1, cstring2); } else printf("輸入錯誤\n"); system("pause"); return(0); }
留言
張貼留言