#import
#include
#include
#define N 40
void fun(char s[],int c)
{
int i=0;
char*p;
p=s;
while(*p)
{
if(*p!=c)
{
s[i]=*p;
i++;
}
p++;
}
s[i]='\0';
}
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
char stra[N],strb[N];
int i;
printf("请输入原始字符串a: ");
gets(stra);
printf("请输入删除字符串b: ");
gets(strb);
for(i=0;strb[i]!='\0';i++)
fun(stra,strb[i]);
printf("删除指定字符串b后的字符串a: ");
puts(stra);
[pool drain];
return 0;
}
Search This Blog
Tuesday, November 17, 2009
C language (Write an alternative version of squeeze(s1,s2) that deletes each character in s1 that matches any character in the string s2)
char is Int
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment