Login
Immutable PageDiscussionInfoAttachments
Diff for "rei05/C言語"

MMA
Differences between revisions 5 and 6
Revision 5 as of 2012-05-08 17:46:33
Size: 430
Editor: rei05
Comment:
Revision 6 as of 2012-05-08 17:47:04
Size: 430
Editor: rei05
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
==Help Me!== = Help Me! =

Help Me!

#include<stdio.h>

int main(){

int num,i,pri;
char ch,counter[256]={0};

while(1){
  scanf("%c",&ch);
    if(ch=='\n') break;
  if('a'<=ch&&ch<='z'){
    num=ch-'a';
    counter[num]++;
  }else if('A'<=ch&&ch<='Z'){
    num=ch-'A';
    counter[num]++;
  }
}

for(i=0;i<=25;i++){
  pri=counter[i];
  printf("%c : %d\n",i+'a',pri);
}

return(0);
}

rei05/C言語 (last edited 2012-07-16 17:50:37 by nomeaning)