11-05-02-2.cpp
来自「more efftive 代码」· C++ 代码 · 共 29 行
CPP
29 行
#include <iostream>#include <cstring>#include <cctype>#include <algorithm>using namespace std;inline bool eq_nocase(char c1, char c2) { return toupper(c1) == toupper(c2);}int main(){ const char* s1 = "This is a Test"; const char* s2 = "This is a test"; const int N = strlen(s1); pair<const char*, const char*> result = mismatch(s1, s1 + N, s2, eq_nocase); if (result.first == s1 + N) cout << "The two strings do not differ" << endl; else { cout << "The strings differ starting at character " << result.first - s1 << endl; cout << "Trailing part of s1: " << result.first << endl; cout << "Trailing part of s2: " << result.second << endl; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?