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 |
无论如何都看不出哪里有错,请高手指点#include <iostream.h> void main() { char szLetters[4][73]; for (int i=0;i<4;i++){ cin.getline(szLetters[i],73); } int nSta[26]; for (int j=0;j<26;j++) nSta[j]=0; for (i=0;i<4;i++){ for (int j=0;j<72;j++){ if (szLetters[i][j]>='A'&&szLetters[i][j]<='Z') nSta[szLetters[i][j]-'A']++; } } int nMaxFrequency=0; for (int k=0;k<26;k++){ if (nSta[k]>=nMaxFrequency) nMaxFrequency=nSta[k]; } int nCurrentFrequency=nMaxFrequency; for (;nCurrentFrequency>0;nCurrentFrequency--){ for (int l=0;l<25;l++){ if (nSta[l]>=nCurrentFrequency){ cout <<"* "; } else cout <<" "; } if (nSta[25]>=nCurrentFrequency) cout << "*\n"; else cout << "\n"; } 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