chapter2-25.cpp

来自「C++STL程序员开发指南」· C++ 代码 · 共 22 行

CPP
22
字号
//文件名:CHAPTER2-25.cpp
#include <string> 
#include <iostream> 
#include <algorithm> 
#include <cctype> 
using namespace std;
int main() 
{ //create a string
string s("The zip code of Hondelage in Germany is 38108"); 
cout << "original: " << s << endl;
//lowercase all characters
transform (s.begin(), s.end(), //source
s.begin(), //destination
tolower); //operation
cout << "lowered: " << s << endl;
//uppercase all characters
transform (s.begin(), s.end(), //source
s.begin(), //destination
toupper); //operation
cout << "uppered: " << s << endl;
}

⌨️ 快捷键说明

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