Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:请教各位这个程序那里错了??In Reply To:请教各位这个程序那里错了?? Posted by:zjl at 2005-02-27 23:23:14 # include <iostream.h> # include <string.h> # define MAX 72 # define NUM 26 void main(){ char c[MAX]; int i,a[NUM],j; for(i=0;i<NUM;i++) a[i] = 0; for(i=0;i<4;i++){ cin.getline(c,MAX); for(j = 0;j<MAX;j++){ if(c[j]>='A'&&c[j]<='Z') a[c[j]-'A']++; } memset(c,0,sizeof(c)); } int nmax = a[0]; for(i=0;i<NUM-1;i++){ if(nmax<a[i+1]) nmax=a[i+1]; } for(i=0;i<nmax;i++){ for(j=0;j<NUM-1;j++){ if(a[j]>=(nmax-i)) cout<<"* "; else cout<<" "; } if(a[NUM-1]>=(nmax-i)) cout<<"*"; else cout<<" "; cout<<endl; } cout<<"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"<<endl; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator