头文件

常见头文件

#include 《cstdio>

#include 《cmath>

http://www.cplusplus.com/reference/cmath/

#include 《algorithm>

http://blog.csdn.net/wlchen123/article/details/8219131

常见的:max、min、sort 、swap、

#include 《iostream>

#include 《cstring>

http://www.cnblogs.com/xFreedom/archive/2011/05/16/2048037.html

C++里的 cstring对应C语言的string.h

string.h是C中处理字符串的函数的声明,string是C++中string类的头文件,尽管在C++中包含string.h是允许的,但C++标准建议用头文件cstring来替代string.h

里面常用:

strcmp(a,b)==0  比较字符串是否相同,相同返回值是0,a>b返回正数;a《b返回负数

memset(a,0,sizeof(a));      把字符串清空(所有字符元素全变成\0)

strlen(a);          计算这个字符串的长度(到第一个\0为止)

strcpy

strcat:char * strncat ( char * destination, const char * source, size_t num );

Append characters from string

Appends the firstnumcharacters ofsourcetodestination, plus a terminating null-character.

If the length of the C string insourceis less thannum, only the content up to the terminating null-character is copied.

size()

length()

reverse()

substr()  string substr (size_t pos = 0, size_t len = npos) const;

find()  若查找成功,返回按查找规则找到的第一个字符或子串的位置;若查找失败,返回npos,即-1(打印出来为4294967295)

#include 《map>

#include 《string>

C++中,string头文件基本上已经包含在iostream中了。

但是,平时使用的时候建议加上#include(尤其在以下情况下)

1、使用string类型

2、使用cin、cout语句来输入输出string类型变量(注意,同时还需要#include)

3、使用memset()、strlen()、strcpy()、strcat等函数时

函数原型char *strcpy(char *dest,const char *src)

#include 《stack>

#include 《cctype>

#include 《vector>

#include 《queue>

#include 《set>

#include 《utility>

#include 《cassert>

#include 《numeric>

#include 《sstream>

using namespace std;

#define Online_Judge

#define outstars cout << "***********************" << endl;

#define clr(a,b) memset(a,b,sizeof(a))

#define lson l , mid  , rt << 1

#define rson mid + 1 , r , rt << 1 | 1

#define mk make_pair

const int MAXN = 1000 + 50;

const int MAXS = 10000 + 50;

const int sigma_size = 26;

const long long LLMAX = 0x7fffffffffffffffLL;

const long long LLMIN = 0x8000000000000000LL;

const int INF = 0x7fffffff;

const int IMIN = 0x80000000;

const int inf = 1 << 30;

#define eps 1e-10

const long long MOD = 1000000000 + 7;

const int mod = 10007;

typedef long long LL;

const double PI = acos(-1.0);

typedef double D;

typedef pair pii;

typedef vector vec;

typedef vector mat;

typedef vector vs;

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 一、字符串操作 strcpy(p, p1) 复制字符串 strncpy(p, p1, n) 复制指定长度字符串 s...
    JaiUnChat阅读 1,785评论 0 7
  • 本文转自:http://www.cnblogs.com/lidabo/p/5225868.html 1)字符串操作...
    XiaohuiLI阅读 9,724评论 0 0
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 137,150评论 19 139
  • 在c语言中,字符串是用字符数组来存储的(并不像c++或者java等语言中有单独的string类型), 存放时在字符...
    朱森阅读 1,744评论 0 2
  • (一) 想起敦煌小镇,总会让人想到那首经典的老歌,总会让人想起熟悉的普洱茶,总会让人想起那个从人间烟火中走出来的含...
    东方地秀阅读 650评论 42 29

友情链接更多精彩内容