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 |
提交了好多次都是wrong answer.哪位好心指点?#include<iostream.h> int maximum(int a[],int b){ int max = a[0]; int i = 0; while((i + 1)<b){ if(a[i + 1]>max) max = a[i + 1]; i++; } return max; } int a[26]; void main(){ int i,j,k,r,d = 1; char input[4][72]; for(i = 0;i < 4;i++){ cin.getline(input[i],72); for(j = 0;j < 72;j++){ if(input[i][j] >= 'A'&&input[i][j] <= 'Z') a[input[i][j] - 'A']++; } } k = maximum(a,26); for(d = 1;d <= k;d++){ for(r = 0;r < 25;r++){ if(d > (k-a[r])) cout<<"* "; else cout<<" "; } if(d > (k-a[25])) 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"; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator