4.8.2 创建程序

2013-10-07 14:45:32 · 作者: · 浏览: 61

4.8.2  创建程序

像往常一样,程序以一些注释和需要的头文件开始。

  1. // Hangman  
  2. // The classic game of hangman  
  3. #include <iostream> 
  4. #include <string> 
  5. #include <vector> 
  6. #include <algorithm> 
  7. #include <ctime> 
  8. #include <cctype> 
  9. using namespace std;  

注意,上面的代码中包含了一个新的文件cctype。它是标准库的一部分,并且包含将字符转换为大写形式的函数。在比较单个字符时,程序使用这些函数比较apples和apples(大写形式之间的比较)。