c++
文章平均质量分 67
同呼呼啦
这个作者很懒,什么都没留下…
展开
-
C++sort函数关于数组、容器vector、字符串类string排序
一、作用:C++中自带的排序方法,需要提供序列的头、尾地址,和排序方式(降序或升序)。其中时间复杂度为n*log2(n),效率较高!二、用法:(1)头函数:#include std::sort(2)参数:sort(start,end,ways)start:序列头地址end:序列尾地址ways:排序方式,升序或降序,默认排序为升序。可自定义,也可以使用内置排原创 2017-08-28 13:05:14 · 6018 阅读 · 0 评论 -
localtime_s时间转换为字符串
std::string getTime(void){ time_t now; time(&now); // 定义两个变量,存储转换结果 struct tm tmTmp; char stTmp[TIME_MAX]; // 转换为tm结构 localtime_s(&tmTmp, &now); // 转换为字符串并输出 asctime_s(stTmp, &tmTmp); ...原创 2018-06-02 22:13:38 · 4509 阅读 · 0 评论