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. 015-HQL中级5-hive创建索引

    索引是hive0.7之后才有的功能,创建索引需要评估其合理性,因为创建索引也是要磁盘空间,维护起来也是需要代价的 创建索引 hive> create index [index_studentid ...

  2. js老生常谈之this,constructor ,prototype

    前言 javascript中的this,constructor ,prototype,都是老生常谈的问题,深入理解他们的含义至关重要.在这里,我们再来复习一下吧,温故而知新! this this表示当 ...

  3. Linux PHP7的openssl扩展安装

    Linux环境下使用PHPmailer发送邮件时,出现如下错误: SMTP -> ERROR: Failed to connect to server: Unable to find the s ...

  4. DOM扩展学习笔记

    对DOM的两个主要扩展是Selectors API(选择符API)和HTML5,还有一个不太瞩目的Element Traversal元素遍历规范为DOM添加了一些属性,另外还有一些专有扩展. 选择符A ...

  5. 网页中Cache各字段含义

    Pragma 当该字段值为"no-cache"的时候(事实上现在RFC中也仅标明该可选值),会知会客户端不要对该资源读缓存,即每次都得向服务器发一次请求才行. Expires 有了 ...

  6. RNNs

    什么是RNN网络? RNNs背后的主要目的是要使用序列本身的顺序信息.在传统的神经网络里,我们假设输入(输出)是条件独立的.但是,在许多任务里,这是个非常非常差的假设.如果你想预测一个序列中的下一个单 ...

  7. [golang note] 类型系统

    值和引用 • 值语义和引用语义 值语义和引用语义的差别在于赋值: b = a b.Modify() 如果b的修改不会影响a的值,那么属于值类型,否则属于引用类型. • 值类型和引用类型 √ 引用类型一 ...

  8. jq--ajax中止请求

    比如我后端设置延迟3s再响应给前端,我用的是node之koa2 router.get('/vueDemo/getStudents', async ( ctx ) => { //延迟3s asyn ...

  9. centos 升级nginx到1.10.2

    之前装的是1.6.3版本,准备升级到1.10.2版本. 1.下载nginx1.10.2 wget http://nginx.org/download/nginx-1.10.2.tar.gz 2.解压缩 ...

  10. 使用react常见的坑

    触摸事件 React中的触摸事件仅用三种,touchstart, touchend, touchend,可是这种会有问题,有时候我需要滚动页面的时候,很容易触发某一个元素的touchend事件,为此笔 ...