#include <iostream>
#include<string>
using namespace std;
int main()
{
string str="hello world";
for(string::iterator it=str.begin();it!=str.end();++it)
printf("%c",*it);
}
用迭代器(类似于指针)访问字符串
本文展示了如何使用C++的基本语法,包括iostream库,string类型和迭代器,实现一个简单的程序,遍历并打印字符串helloworld
访问字符串&spm=1001.2101.3001.5002&articleId=136429157&d=1&t=3&u=58667d53cb8b47999c347038805ac4a0)

被折叠的 条评论
为什么被折叠?



