回覆列表
  • 1 # 好看美劇

    /*已測試過,沒有問題,不懂可以追問,希望對你有幫助.*/#include <stdio.h>#include <string.h> #define LEN 1024 size_t Strlen(char x[],char y[]); int main(){ char str1[LEN] = "\0"; char str2[LEN] = "\0"; printf("請輸入第一段文字:\n"); scanf(" %s",str1); printf("請輸入第二段文字:\n"); scanf(" %s",str2); printf("不同的元素個數為:%u\n",Strlen(str1,str2)); return 0;} size_t Strlen(char x[],char y[]) //按你所說的,用大的陣列長度減去小的陣列長度; { size_t len = 0; size_t len_x = strlen(x); size_t len_y = strlen(y); if(len_x > len_y) len = len_x - len_y; else len = len_y - len_x;

  • 中秋節和大豐收的關聯?
  • 如何應用因果定律改變命運?