📄 ex0906.cpp
字号:
// Programming with C++, Second Edition, by John R. Hubbard
// Copyright McGraw-Hill, 2000
// Example 9.6 on page 217
// Capitalizing all the words in a text file
#include <fstream>
#include <iostream>
using namespace std;
int main()
{ ifstream infile("input.txt");
ofstream outfile("output.txt");
string word;
char c;
while (infile >> word)
{ if (word[0] >= 'a' && word[0] <= 'z') word[0] += 'A' - 'a';
outfile << word;
infile.get(c);
outfile.put(c);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -