NUN_BE

|
分享:
▲
▼
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char a[1000][1000]; char temp[1000]; int i,x,y,z,sum=2,stop; for(i=0;stop!=2;i++) { printf("請任意輸入字串:"); scanf("%s",&a); printf("請問您是否繼續輸入?要=1 不要=2:"); scanf("%d",&stop); } for(x=0;x<=i-2;x++) { for(y=x+1;y<=i-1;y++) { if(strcmp(a[x],a[y])>0) { strcpy(temp,a[x]); strcpy(a[x],a[y]); strcpy(a[y],temp); } } } for(z=0;z<i-1;z++) { if(strcmp(a[z],a[z+1])==0) { sum++; } else { printf("%s %d\n",a[z],sum); sum=1; } } system("pause"); } 這是我打的= = 但是字串跟數字都怪怪的 輸不出來= = 明天要交作業ㄌ= = ㄏㄏ... 可以幫我錯的改一改嚜= = 拜託 大大們= =
|