set,unordered_set:
set:容器,内容不重复且排序好的
unordered_set:和set一样,但是无序的
如set<string> hash,set<int>hash,unordered_set<string>hash;
应用:
hash.insert(str):添加str;
hash.count(str):计数,输出str的次数(只有0和1),可用于判断是否有str;
substr:
用于截取字符串,如a.substr(6,8)即截取字符串a中下标为6的字符起始截取8个字符这个片段,若第一个参数为负数即下标为倒数的字符起始;若只有一个参数,默认截取到字符串末尾;
也可用于比较俩个字符串特定片段,如:a.substr(6,8)>b.substr(6,8);
getchar:
用于读取字符的函数;
int getchar(void)
返回值为int,参数为void
1.其实返回的是字符的ASCII码值
2.读取结束或失败时返回EOF(-1)
它可以从你输入的字符串中一个一个的读取
#include<bits/stdc++.h>
using namespace std;
int main()
{
while((ch=getchar())!=EOF)//!=-1
{
cout<<ch;
}
return 0;
}
如上,如果输入abcdefg,输出也是abcdefg.
三角函数:
头文件:#include<cmath>
sin(double),cos(double),tan(double),asin(double),acos(double),atan(double);
asin即arcsin(反三角函数)
例:y = asin(x); x = sin(y); y和x都是double;