24小时热门版块排行榜    

查看: 348  |  回复: 0

i2002i2002

木虫 (正式写手)

[求助] 计算机二级 C题目

这个题目的答案看不懂啊,有没有人帮忙解答一下,while(q<h)里面的比较是怎么回事
#include <stdio.h>
void  fun( char *a, char *h,char *p )
{
int i=0;
char *q=a;
while(q<h)
{
a=*q;
q++;
i++;
}
while(q<p)
{if(*q!='*')
{a=*q;
i++;
}
q++;
}
while(*q)
{
a=*q;
i++;
q++;
}
a='\0';
}

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) ;
}

计算机二级 C题目
123.JPG
回复此楼

» 猜你喜欢

梦想还是要有的
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 i2002i2002 的主题更新
信息提示
请填处理意见