c++ string 语法

[复制链接]
查看11 | 回复3 | 2012-4-6 19:43:36 | 显示全部楼层 |阅读模式
#include #include using namespace std;int main(){string word="我有电脑有电脑";for(string::size_type i=0;i!=word.size();i+=2) //汉字是双字节编码,也就是1个汉字占两个普通字符的单元{string x="";x[0]=word;x[1]=word[i+1];if(x=="电"){x="P ";word = x[0];word[i+1] = x[1];}if(x=="脑"){x="C ";...
回复

使用道具 举报

千问 | 2012-4-6 19:43:36 | 显示全部楼层
你看看C里面strtok的用法,还有string的接口库,主要还是自己看看会比较好。...
回复

使用道具 举报

千问 | 2012-4-6 19:43:36 | 显示全部楼层
CSTRING string = “我有电脑有电脑”;string. Replace('电脑', 'PC' );...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行