剑指offer || 03_replaceBlank
来源:互联网 发布:智能黑科技软件 编辑:程序博客网 时间:2024/05/19 20:18
#include"string.h"#include<iostream>using namespace std;void ReplaceBlank(char str[]){if (strlen(str) == 0)return;//find num of blankint NumOfBlank = 0;for (int i = 0; i < strlen(str); i++){if (str[i] == ' ')NumOfBlank++;}int j = strlen(str) + NumOfBlank * 2;int i = strlen(str) - 1;str[j--] = '\0';while (i >= 0){if (str[i] == ' '){str[j--] = '0';str[j--] = '2';str[j--] = '%';}else{str[j--] = str[i];}i--;}return;}int main(){char b[50] = { " " };ReplaceBlank(b);return 0;}
0 0
- 剑指offer || 03_replaceBlank
- 04_ReplaceBlank替换空格
- 剑指offer-03
- 剑指OFFER
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指offer
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指offer
- 《剑指offer》
- string 类
- unix网络编程各种TCP客户-服务器程序设计实例(二)
- Summer Holiday (hdu 1827 强联通缩点)
- unix网络编程之基本套接口编程
- linux网络基础-远程管理
- 剑指offer || 03_replaceBlank
- javascript用正则表达式检测用户名的合法性
- unix网络编程各种TCP客户-服务器程序设计实例附环境搭建和编译方法(一)
- android 获取应用列表 点击打开应用
- 指针的问题2 指向常量的指针与常量指针
- POJ 3087 Shuffle'm Up(简单模拟)
- pkg和gtk安装
- JSR 303 - Bean Validation 简介及使用方法
- 将博客搬至CSDN