首页 > 编程语言 > 详细

C++标准模板库介绍

时间:2020-09-03 09:09:17      阅读:58      评论:0      收藏:0      [点我收藏+]

vector的常见用法详解

  #include <vector>
  using namespace std;
  vector<int> a;
  vector<vector<int> > b;

  .[index]
  .begin()/.end()
  ::iterator
  push_back/pop_back
  size/clear/insert/erase删除一个或一个区间

set的常见用法

  #include <set>
  using namespace std;
  set<int> a;
  ::iterator
  .insert/.begin/.end/.find/.erase删除一个用位置,用键值,删除区间/.size/.clear
  
  set内元素自动排序且去除重复元素

string常见用法

  #include <string>
  using namespace std;
  
  string str = "abc";
  .length/.[index]/

  要读入和输出整个字符串,只能用cin和cout
  #include <iostream>
  #include <string>
  using namespace std;
  string str;
  cin >> str;
  cout << str;

  .c_str()/::iterator/operator+=/==/!=/</<=/>/>=

C++标准模板库介绍

原文:https://www.cnblogs.com/raindayinrain/p/13605293.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!