⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cstring_iter.cpp

📁 斯坦福Energy211/CME211课《c++编程——地球科学科学家和工程师》的课件
💻 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 + -