# include "stdlib.h"
char mygetc(int n,char ch[])
{
//printf("--%d-%c--\n",n,ch[n])
return ch[n]
}
void myput(int n,int e,char *p)
{
int i=0,flag=0
if(n==2)
{
for(i=e-ni<ei++)
{
if(p[i]!=mygetc(i+n-e,"on")&&p[i]!=mygetc(i+n-e,"ON"))
{
break
}
}
if(i==e)
flag++
for(i=e-ni<ei++)
{
if(p[i]!=mygetc(i+n-e,"in")&&p[i]!=mygetc(i+n-e,"IN"))
{
break
}
}
if(i==e)
flag++
for(i=e-ni<ei++)
{
if(p[i]!=mygetc(i+n-e,"at")&&p[i]!=mygetc(i+n-e,"AT"))
{
break
}
}
if(i==e)
flag++
for(i=e-ni<ei++)
{
if(p[i]!=mygetc(i+n-e,"an")&&p[i]!=mygetc(i+n-e,"AN"))
{
break
}
}
if(i==e)
flag++
}
else if(n==4)
{
for(i=e-ni<ei++)
{
if(p[i]!=mygetc(i+n-e,"from")&&p[i]!=mygetc(i+n-e,"FROM"))
{
break
}
}
if(i==e)
flag++
}
if(flag==0)
{
for(i=e-ni<=ei++)
printf("%c",p[i])
}
}
void main()
{
FILE *f
char *fpath="d:\\1.txt",*str
str=(char *)malloc(10000)
int b,i
f=fopen(fpath,"r")
if(!f)
{
printf("no file error.\n")
}
else
{
while(fgets(str,10000,f)!=NULL)
{
i=0
b=0
while(str[i]!='\0')
{
if(str[i]>='A'&&str[i]<='Z'||str[i]>='a'&&str[i]<='z')
{
b++
}
else
{
myput(b,i,str)
b=0
}
i++
}
}
myput(b,i,str)
}
fclose(f)
printf("\n")
}
#include<stdio.h>#include<windows.h>//因为用了Sleep,所以添加头文件<windows.h>
#include<stdlib.h>//因为使用了system,所以添加头文件<stdlib.h>
int main()
{
char a[20]
int b,c,d
printf("\n\t\t请输入20以内的字母:")
scanf("%s",a)
for(b=0b<20b++)
{
if(a[b]=='n')//a[0]---a[19]判断是否等于“n”
{
for(c=bc<20c++)
{
a[c]=a[c+1]//如果等于“n”,那么a[b]后面的数依次的给前面的数赋值,因为a[b],b不能变动,所以用a[c]。
}
}
}
printf("\n\t\t屏蔽字母“n”中-")
for(d=0d<40d++)
{
Sleep(50)//暂停 50 毫秒,做出动画的效果
printf("-")
}
printf("\n\n\t\t最后结果:")
printf("%s\n",a)
system("pause")//会自动的添加文字“按任意键继续”
exit(0)//直接的退出程序
return 0
}
思路正确
#include <stdio.h>#include <stdlib.h>
void del(char* b, char* c)
{
int i=0,c_pos=0,j=0
while(b[i]!='\0')
{
j=0
for(j=0j<c_posj++)
{
if(b[i]==c[j])
{
break
}
}
if(j==c_pos)
{
c[c_pos++]=b[i]
}
i++
}
c[c_pos]='\0'
}
int main()
{
char b[50],c[50]
scanf("%s",b)
del(b,c)
printf("\n%s",c)
return 0
}