1.vector的使用 基本(C++ 动态化实现)

创建 vector<int> hh;

末尾添加  hh.push_back();

查找元素按照 下标  hh[1];

大小  hh.size();

其余:https://www.cnblogs.com/zhonghuasong/p/5975979.html

2.map (红黑树实现) 的使用:(key没有重复的!!)hash_map(哈希表实现)可以重复key值

自动建立Key - value的对应。key 和 value可以是任意你需要的类型。

 

创建:map<int,string>hhh;

插入:hhh.insert(pair<int,string>(1,"jkjkj"));//pair 是另外一种数据结构

 hhh[2]="lalalla";

查找:

     map<nt,string> xx=hhh.find(1);//返回的是一个(key-value)形式的

     if(xx!=hhh.end()){//判断是否find没有找到这个值

       cout<<success!;

    }

 

int xx=hhh.count(1);//找到返回1,找不到返回0;

 

删除:

   hhh.erase(1);

C++中的常用数学函数

头文件cmath.h或math.h中包含的常用数学函数,使用时要头文件引用

1.开平方

double sqrt(double x);

2.求常数e的x次方

double exp(double x);

3.求x的y次方

double pow(double x, double y);

4.求对数ln(x)

double log(double x);