Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //判斷中文英文字2.c
- //https://www.facebook.com/groups/1403852566495675/permalink/2162353213978936/?__tn__=-R
- //Kuo_Hsiang_Yu
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char *argv[])
- {
- system("color f0");
- char input[100] = {};
- printf("請輸入字串:");
- gets(input);
- //逐一處理處理每個字元
- int i = 0;
- for (i = 0; i < strlen(input); i++)
- {
- if ((int)input[i] < 0)
- {
- //中文字元
- printf("您輸入的字串包含中文字。\n");
- i = i + 1;
- }
- else
- {
- //英文字元
- printf("您輸入的字串包含英文字或阿拉伯數字。\n");
- }
- }
- printf("\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement