Chinaunix首页 | 论坛 | 博客
  • 博客访问: 359765
  • 博文数量: 100
  • 博客积分: 2500
  • 博客等级: 大尉
  • 技术积分: 1209
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-15 21:24
文章分类

全部博文(100)

文章存档

2011年(100)

分类: C/C++

2011-04-21 13:35:09

  1. iterator begin();
  2. const_iterator begin() const;
  1. iterator end();
  2. const_iterator end() const;
Example:
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;

  4. int
  5. main(void)
  6. {
  7.         string str1, str2, str3;
  8.         str1 = "Test string:";
  9.         str2 = 'x';
  10.         str3 = str1 + str2;
  11.         cout << str3 << endl;

  12.         return (0);
  13. }

  1. reverse_iterator rbegin();
  2. const_reverse_iterator rbegin() const;
  1. reverse_iterator rend();
  2. const_reverse_iterator rend() const;
Example:
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;

  4. int
  5. main(void)
  6. {
  7.         string str ("Test string");
  8.         string::reverse_iterator rit;
  9.         for (rit=str.rbegin(); rit != str.rend(); rit++)
  10.                 cout << *rit;

  11.         return (0);
  12. }

阅读(1192) | 评论(0) | 转发(0) |
0

上一篇:管道

下一篇:String III Capacity

给主人留下些什么吧!~~