ex0906.cpp
来自「practice c++, it is from the book http:/」· C++ 代码 · 共 22 行
CPP
22 行
// 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 + =
减小字号Ctrl + -
显示快捷键?