OJ项目三

来源:互联网 发布:golang java 性能对比 编辑:程序博客网 时间:2024/06/14 21:13
//*Copyright (c) 2014, 烟台大学计算机学院                                 //* All rights reserved.                                 //* 文件名称:test.cpp                                 //* 作    者: 徐洪祥                                 //* 完成日期:2014年11月24日                                 //* 版 本 号:v1.0                                 //*                                 //* 问题描述:元音字母统计                          //* 输入描述:                               //* 程序输出:#include <iostream>#include <cstdio>using namespace std;int main(){    char str[100];    int j,A,E,I,O,U;    A=E=I=O=U=0;    gets(str);    while(str[j]!='\0')    {        if (str[j]=='a')            A++;        else if(str[j]=='e')            E++;        else if(str[j]=='i')            I++;        else if(str[j]=='o')            O++;        else if(str[j]=='u')            U++;            j++;    }    cout<<"a:"<<A<<endl;    cout<<"e:"<<E<<endl;    cout<<"i:"<<I<<endl;    cout<<"o:"<<O<<endl;    cout<<"u:"<<U<<endl;    return 0;}

0 0
原创粉丝点击