soln4_3.cpp

来自「Visual C++ 2005的源代码」· C++ 代码 · 共 21 行

CPP
21
字号
// Soln4_3.cpp
#include <iostream>
#include <string>
using std::cout;
using std::endl;

int main()
{
   char str[] = "Doctor Livingstone, I presume?";
   cout << str << endl;                     // Output the string

   for (unsigned int i = 0; i < strlen(str); i += 2)
   {
      if (str[i] >= 'a' && str[i] <= 'z')   // If it's lowercase letter
         str[i] -= 32;                      // change to uppercase
   }

   cout << str << endl;                     // Output the modified string
   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?