【Cpp】删除字符串空格

来源:互联网 发布:阿里云ecs搭建ss 编辑:程序博客网 时间:2024/05/23 19:16
#include <iostream>#include <Windows.h>#include <Stdlib.h>using namespace std;int main(void) {                     char sz[] = "1 2 z1 " ;  char *p = sz;int len = strlen(p);cout << p << endl;/*Clear Space*/while (*p) {if ((' ' == *p ))//||( '1'==*p) lstrcpy(p, p + 1);if ((' ' != *p)) // || ('1' == *p)p++;}/*Clear Space*/cout << sz << endl;system("Pause");return EXIT_SUCCESS;}

0 0