#include<iostream>
#include<cstring>
using namespace std
int check(char *str,char *nosign)
void trans(char *str)
#define MAXLENGTH 30
#define STANDARD 20
int main()
{
char str[MAXLENGTH]
char newstr[STANDARD]
char store[STANDARD]
char *address[STANDARD]
char *pt
char *mark
char nosense[20] = {'@','#','$',',','.','"',' ','\0'}
char word[5][10] = { "L4","FD","D26"}
int i = 0
int k = 0
int l = 0
int count = 3
int num = 5
bool flag = true
int m = 0
char *p
char yorn
p = word
do
{
cout <<"\n请输入和谐词,输入“|”停止\n"
cin >>p[count]
count++
if( count == num &&p[count-1] != '|')
{
num = 2*num
p = new char[num][10]
for(m=0m <num/2m++)
p[m] = word[m]
}
}
while(p[i-1] != '|')
//上面一部分
cout <<"
cin >>yorn
if( yorn == 'y' )
cin.getline(nosense,20)
do
{
cout <<"输入字符串(不多于20个字符):\n"
cin.getline(str,30)
if( strlen(str) >STANDARD || check(str,nosense) == 1 )
{
cout <<"输入错误\n"
}
}
while( strlen(str) >STANDARD || check(str,nosense) == 1 )
cout <<"\n字符串是:"<<str <<endl
strcpy(newstr,str)
strupr(newstr)
pt = newstr
for(i = 0i <strlen(pt)i++)
{
if( pt[i] != '*')
{
address[k] = &str[i]
store[k] = pt[i]
k++
}
}
for(i = 0i <counti++)
{
if( strstr(store,word[i]) )
{
mark = strstr( store,word[i] )
for( l = 0 l <strlen(word[i])++l)
*(mark + l) ='*'
}
}
for( i = 0 i <strlen(newstr)++i )
{
if ( store[i] == '*')
{
*address[i] = '*'
}
}
cout <<"\n和谐后的句子是" <<str <<endl
return 0
}
int check(char *str,char *nosign)
{
int i = 0
int k = 0
bool flag = false
for(i = 0i <strlen(str)i++)
{
if(!( ( str[i] >= 'a' &&str[i] <= 'z' )||(str[i] >= 'A' &&str[i] <= 'Z')||(str[i] >= '0'&&str[i] <= '9')))
{
flag = false
for( k=0 k <strlen(nosign)k++)
{
if ( str[i] == nosign[k])
{
str[i] = '*'
flag = true
break
}
}
if (!flag)
{
return 1
}
}
}
return 0
}
微信文字过滤小程序叫“文字过滤小助手”,它是一款专为微信用户提供的文字过滤服务的小程序,可以帮助用户快速、准确地过滤不良信息,帮助用户避免发布违规内容,提高微信账号的安全性。小程序的功能非常强大,可以根据用户的需求进行定制,过滤掉不良信息,如政治敏感词汇、色情暴力等,从而保护用户的账号安全。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)