poj 2688求字母个数

#include<iostream>
#include<stdio.h>
#include<string.h>
#define N 80
using namespace std;
int main()
{
    char test[N];
    int counta=0,counte=0,counti=0,counto=0,countu=0;
    gets (test);
    int i;
    for(i=0;i<N && test[i]!='\0';i++){
        if(test[i]=='a')  counta++;
         else if(test[i]=='e')  counte++;
           else if(test[i]=='i') counti++;
             else if(test[i]=='o') counto++;
                else if
                (test[i]=='u') countu++;
                }
     cout<<counta<<" "<<counte<<" "<<counti<<" "<<counto<<" "<<countu<<" "<<endl;
     return 0;
}

posted @ 2012-04-18 20:26  逝者*恋世  阅读(166)  评论(0编辑  收藏  举报