char* newstr(char * str){
    if(str == NULL)
        return NULL;
    int blank = ;
    int len = strlen(str);
    int i = ;
    for(i = ; i < len ; i++)
        if(str[i] == ' ')
            blank++;
    int j = ;
    char * newhead = new char[len + blank* +];
    for(i = ; i < len; i++){
        if(str[i] != ' ')
            newhead[j++] = str[i];
        else{
            newhead[j++] = '%';
            newhead[j++] = '';
            newhead[j++] = '';
        }
    }
    newhead[j] = '\0';
    str = newhead; 
    return str;
}

ctci1.4的更多相关文章

  1. ctci1.8

    bool isSub(string str0, string str1){     if(str0.length() != str1.length())         return false;   ...

  2. ctci1.3

    ; i < len; i++){         if(str0[i] != str1[i])             return false;     }          return t ...

  3. ctci1.2

    ;     ; i < len/; i++){         tmp = *(str+i);         *(str+i) = *(str+len--i);         *(str+l ...

  4. ctci1.1

    )         ;     ; i < len; i++){         if(place.find(str[i]) == place.end())             place. ...

随机推荐

  1. Spark 2.2 DataFrame的一些算子操作

    Spark Session中的DataFrame类似于一张关系型数据表.在关系型数据库中对单表或进行的查询操作,在DataFrame中都可以通过调用其API接口来实现. 可以参考,Scala提供的Da ...

  2. 七、Mosquito 集群搭建

    本章主要讲述Mosquitto 集群搭建的两种方式 1.进行双服务器搭建 2.进行多服务器搭建 一.Mosquitto的分布式集群部署 如果需要做并发量很大的时候就需要考虑做集群处理,但是我在查找资料 ...

  3. 移植nand驱动补缺:make mrproper与make clean以及make distclean,find/grep. makefile

    make mrproper与make clean以及make distclean的区别: linux内核源码根目录下面的makefile中有很清晰的解析: useage: “clean”:Remove ...

  4. 关于LDA的gibbs采样,为什么可以获得正确的样本?

    算法里面是随机初始了一个分布,然后进行采样,然后根据每次采样的结果去更新分布,之后接着采样直到收敛. 1.首先明确一下MCMC方法. 当我们面对一个未知或者复杂的分布时,我们经常使用MCMC方法来进行 ...

  5. tcp五层模型

    物理层由来:上面提到,孤立的计算机之间要想一起玩,就必须接入internet,言外之意就是计算机之间必须完成组网 物理层功能:主要是基于电器特性发送高低电压(电信号),高电压对应数字1,低电压对应数字 ...

  6. Writing a device driver for Windows

    Writing a device driver for Windows        In order to write a device driver for windows, one needs ...

  7. 2016-2017 ACM-ICPC Southwestern European Regional Programming Contest (SWERC 2016) B - Bribing Eve

    地址:http://codeforces.com/gym/101174/attachments 题目:pdf,略 思路: 把每个人的(x1,x2)抽象成点(xi,yi). 当1号比i号排名高时有==& ...

  8. QT解决视频透视,有阴影的方法

    #define BG_DEVNAME "/dev/fb0"#define FG_DEVNAME "/dev/fb1" 课题5, QT界面与视频透明叠加问题:颜色 ...

  9. 在VS2012中采用C++中调用DLL中的函数(4)

    转自:http://www.cnblogs.com/woshitianma/p/3683495.html 这两天因为需要用到VS2012来生成一个DLL代码,但是之前并没有用过DLL相关的内容,从昨天 ...

  10. hive union all使用注意

    UNION用于联合多个select语句的结果集,合并为一个独立的结果集,结果集去重. UNION ALL也是用于联合多个select语句的结果集.但是不能消除重复行.现在hive只支持UNION AL ...