![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c/c++
文章平均质量分 71
qsl19900126
但行好事,莫问前程
展开
-
写一个函数从string中删除一个sub string
#include #include using namespace std;void remove_sub_string(string& src, string& target){ size_t pos = src.find(target); if(pos != string::npos){ src.erase(pos, target.size(原创 2013-03-09 15:45:07 · 530 阅读 · 0 评论 -
求32位int二进制下最左边的bit '1'
源地址:http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijnjava 里就是用的这种方法。#include using namespace std;typedef unsigned int uint32_t;uint32_t highestOneBit(uint32_t v){原创 2013-03-09 17:44:12 · 1475 阅读 · 0 评论 -
插入排序
#include void sort(int* array_p, int n){ int i,j,temp; for (i = 1; i < n; i++){ temp = *(array_p + i); j = i - 1; while(temp = 0){ *(array_p + j + 1) = *原创 2013-03-10 23:23:05 · 377 阅读 · 0 评论