#include <stdio.h>
void fun( char a, char h,char p )
{
int i=0;
char q=a;
while(q<h)
{
a[i]=q;
q++;
i++;
}
while(q<p)
{if(q!='')
{a[i]=q;
i++;
}
q++;
}
while(q)
{
a[i]=q;
i++;
q++;
}
a[i]='\0';
}
void main()
{ char s[81],t, f;
void NONO ( );
printf("Enter a string:\n");gets(s);
t=f=s;
while(t)t++;
t--;
while(t=='')t--;
while(f=='')f++;
fun( s , f,t );
printf("The string after deleted:\n");puts(s);
NONO();
}
void NONO()
{/ 本函数用于打开文件,输入数据,调用函数,输出数据,关闭文件。 /
FILE in, out ;
int i ; char s[81], t, f ;
in = fopen("in.dat","r") ;
out = fopen("out.dat","w") ;
for(i = 0 ; i < 10 ; i++) {
fscanf(in, "%s", s) ;
t=f=s;
while(t)t++;
t--;
while(t=='')t--;
while(f=='')f++;
fun(s, f, t);
fprintf(out, "%s\n", s) ;
}
fclose(in) ;
fclose(out) ;
}
转载于:https://blog.51cto.com/14224115/2367596