摘要:
#include #include using namespace std; int main() { string s; cin>>s; cout<<s.at(2)<<endl; } 阅读全文
posted @ 2016-11-26 16:29
PirateLHX
阅读(663)
评论(0)
推荐(0)
摘要:
#include #include #include #include using namespace std; /* 第一种方法 int main() { string a; cin>>a; reverse(a.begin(),a.end()); cout>a; vector v; vector::iterator iter; for(... 阅读全文
posted @ 2016-11-26 16:24
PirateLHX
阅读(121)
评论(0)
推荐(0)
摘要:
之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够、字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是100%)的需要。我们可以用 = 进行赋值操作,== 进行比较,+ 做串联(是不是很简单?)。我们尽 阅读全文
posted @ 2016-11-26 15:01
PirateLHX
阅读(123)
评论(0)
推荐(0)
摘要:
在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。 1 基本操作 (1)头文件#include<vector>. (2)创建vector对象,vector<int> vec; (3)尾部插入数字:vec.push_back(a); (4)使用下标访问元素,cout<<vec[0 阅读全文
posted @ 2016-11-26 14:43
PirateLHX
阅读(141)
评论(0)
推荐(0)

浙公网安备 33010602011771号