i have a problem with this code i need to scan strings till i give the char 0 and count how many words with 1 char,2,3... etc here is my code : it never stops
include
include
int main() { char a[100]; int length[14],i,k; for (i=1; i<=14; i++) length[i]=0;
do { scanf("%s",a); length[strlen(a)] =length[strlen(a)]+1; }while (a!="0");
printf("Word Length\t|Number of Occurs\n"); for(i=1; i<=14; i++) { printf("%d\t\t|",i); if (length[i]>=1) for (k=1; k<=length[i]; k++) printf("*");
printf("\n"); }
return 0; }
Aucun commentaire:
Enregistrer un commentaire