题目:
函数原型:void fun(char *str1,const char *str2);
参数:"00+f-988-77+9897" "-+"
输出:
00
f
988
77
9897
NULL
请按任意键继续. . .
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
void fun(char *str1,const char *str2)
{
//初始化hash表
int hash[256] = {0};
while(*str2 != '\0')
{
hash[*str2] = 1;
str2++;
}
while(*str1 != '\0')
{
if(hash[*str1] == 1)
{
putchar('\n');
}
else
{
putchar(*str1);
}
str1++;
}
putchar('\n');
puts("NULL");
}
void main()
{
char *s = "00+f-988-77+9897";
const char *n = "-+";
fun(s,n);
}