?? cstring_iter.cpp
字號:
#include <iostream>#include <cstring>#include <cctype>using namespace std;int main(){ char word[] = "hello"; // Random-access iteration for ( unsigned int i = 0; i < strlen(word); i++ ) word[i] = toupper( word[i] ); cout << word << endl; // The same iteration, using a pointer, // is actually more efficient, because // incrementing is a cheaper operation // than the regular addition carried out // by the compiler to compute the address // of word[i] char *cp = word; while ( *cp != '\0' ) *cp++ = tolower( *cp ); for ( char *cp = word; *cp != '\0'; cp++ ) *cp = tolower( *cp ); cout << word << endl;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -