

无一分可增不叫完美,无一分可减才是。--Antoine de Saint-Exuperyweb



删除字符串空格微信
在程序中输入一个字符串,编写程序删除字符串中全部空格,删除空格后,输出字符串。要求使用指针的方法解决。编辑器
输入格式flex
字符串url
输出格式spa
删除掉空格后的字符串.net
输入样例3d
I am from guangdong指针
输出样例code
Iamfromguangdong
1#include<stdio.h>
2#include<string.h>
3int main()
4{
5 char s[80];
6 char *p,*q;
7 gets(s);
8 p=s;
9 q=p;
10 while(*q!='\0')
11 {
12 if(*q!=' ')
13 {
14 *p++=*q;
15 }
16 q++;
17 }
18 *p='\0';
19 puts(s);
20 system("pause");
21}


“If you torture the data enough, it will confess”
- - Ronald Coase




本文分享自微信公众号 - 电子荣耀(gh_05453579ed9d)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。