4.8.2 创建程序
像往常一样,程序以一些注释和需要的头文件开始。
- // Hangman
- // The classic game of hangman
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <ctime>
- #include <cctype>
- using namespace std;
注意,上面的代码中包含了一个新的文件cctype。它是标准库的一部分,并且包含将字符转换为大写形式的函数。在比较单个字符时,程序使用这些函数比较apples和apples(大写形式之间的比较)。