- 新增现代 C++ 教程的 Preface 章节,包括英文和中文版本 - 添加 C++ Primer 练习代码 - 新增 Learn C++ 教程的 C++ 开发简介章节 - 添加头文件解析文档 - 更新 mkdocs.yml,包含新教程的目录结构 - 修改项目设置,使用 Python 3.10环境
27 lines
737 B
C++
27 lines
737 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
|
int main()
|
|
{
|
|
unsigned aCnt = 0, eCnt = 0, iCnt = 0, oCnt = 0, uCnt = 0;
|
|
char ch;
|
|
cout << "请输入一段文本" << endl;
|
|
while (cin >> ch)
|
|
{
|
|
if (ch == 'a') ++aCnt;
|
|
else if (ch == 'e') ++eCnt;
|
|
else if (ch == 'i') ++iCnt;
|
|
else if (ch == 'o') ++oCnt;
|
|
else if (ch == 'u') ++uCnt;
|
|
}
|
|
cout << "Number of vowel a: \t" << aCnt << '\n'
|
|
<< "Number of vowel e: \t" << eCnt << '\n'
|
|
<< "Number of vowel i: \t" << iCnt << '\n'
|
|
<< "Number of vowel o: \t" << oCnt << '\n'
|
|
<< "Number of vowel u: \t" << uCnt << '\n'
|
|
<< "Total number: \t" << aCnt + eCnt + iCnt + oCnt +uCnt<< endl;
|
|
|
|
return 0;
|
|
} |