删除模式串中出现的字符

来源:互联网 发布:代理服务器软件下载 编辑:程序博客网 时间:2024/06/06 01:41
#include<iostream>#include<assert.h>using namespace std;//例如:原始串为:welcome to asted.模式串为:aeiou.char *fun(char *s){assert(s!= NULL);int i=0,j=0;while(s[j] !='\0'){while(s[j] == 'a'||s[j]=='e'||s[j]=='i'||s[j]=='o'||s[j]=='u')j++;s[i++]=s[j++];}return s;}void main(){char str[]="welcom to asted";char *p=fun(str);while(*p !='\0')    cout<<*p++;}

0 0
原创粉丝点击