读书人

待 哪位帮帮小弟我

发布时间: 2012-03-24 14:00:46 作者: rapoo

在线等待 哪位大虾帮帮我 啊
C++取子字符串的函数是什么,具体怎么用啊,头文件是什么? 初级问题,各位大虾帮帮忙

[解决办法]
具体用法我给你举个小例子在下面,运行成功

#include <string>
#include <iostream>
using namespace std;

int main()
{
string str( "hello world ");
string strnew;
strnew=str.substr(6); //取str也就是hello world里的world,即从第6个位置开始取,赋给
cout < <strnew < <endl; //strnew
getchar();
return 0;
}

读书人网 >C++

热点推荐