| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1279 人关注过本帖
标题:c++中string类?
只看楼主 加入收藏
shengyupan
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-8-11
收藏
 问题点数:0 回复次数:7 
c++中string类?
我在编写字符串时,使用的是vc6.0,但是每次我要是想用string类的功能,却告诉我,没有此文件,让我很头痛,请高手指教,~!
搜索更多相关主题的帖子: string 
2005-08-11 15:48
apodemas
Rank: 1
等 级:新手上路
帖 子:153
专家分:0
注 册:2005-4-22
收藏
得分:0 
呵呵,没有忘记包含string文件么?

2005-08-11 16:57
天堂的叛逆者
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2005-8-10
收藏
得分:0 
可以给出出错代码么???~~~~

2005-08-11 18:10
天堂的叛逆者
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2005-8-10
收藏
得分:0 
额。。。。。突然忘了竟然。。。。。
楼主说的是VC哦。。。。。额。。。VC里有类么??~~~~

2005-08-11 18:11
kai
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:52
帖 子:3450
专家分:59
注 册:2004-4-25
收藏
得分:0 
加上头文件
#include <string>
using namespace std;     

请务必注意, 那个string  后面没有 .h 也就是说, 如果你写成 #include <string.h> 就错了.

自由,民主,平等,博爱,进步.
中华民国,我的祖国,中华民国万岁!中华民国加油!
本人自愿加入中国国民党,为人的自由性,独立性和平等性而奋斗!
2005-08-13 01:33
指向指针的指针
Rank: 1
等 级:新手上路
帖 子:339
专家分:0
注 册:2004-8-8
收藏
得分:0 
VC不是CString吗?

/sign.png" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./sign.png');}" onmousewheel="return imgzoom(this);" alt="" />
2005-08-13 15:52
Antigloss
Rank: 1
等 级:新手上路
帖 子:109
专家分:0
注 册:2004-12-30
收藏
得分:0 
CString 是mfc
string 是C++里的stl
2005-08-13 20:26
linw1225
Rank: 3Rank: 3
来 自:福建
等 级:论坛游侠
帖 子:110
专家分:145
注 册:2011-4-7
收藏
得分:0 
今晚刚研究出来,例子可以看下;
#include<iostream>
#include<string>

using namespace std;

int main()
{
    string str[2];
    str[0]="abc";
    str[1]="def";
    cout<<str[0]<<endl;
    cout<<str[1]<<endl;
    return 0;
}
注意的应该就是头文件定义了。

Einmal ist keinmal
2011-04-09 21:17
快速回复:c++中string类?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011834 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved