分页:
上一页 1 2 3 4 5 6 7 8 [9] 10 下一页
if(strcmp(sell[I].dm,sell[j].dm)<0)
{xy=sell[I];
sell[I]=sell[j];
sell[j]=xy;}
else if(strcmp(sell[I].dm,sell[j].dm)==0)
if(sell[I].je{xy=sell[I];
sell[I]=sell[j];
sell[j]=xy;}
}
14、函数ReadDat()的功能是实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中;请编制函数StrOL(),该函数的功能是:以行为单位对行中以空格或标点符号或标点符号为分隔的所有单词进行倒排。最后把已处理的字符串(应不含标点符号)仍按行重新存入字符串数组xx中,最后调用函数WriteDat()把结果xx输出到文件OUT6.DAT中。
例如:原文:You He Me
I am a student.
结果:Me He You
student a am I
试题程序:
char xx[50][80];
int maxline=0;/*文章的总行数*/
int ReadDat(void);
_______________________________
void StrOL(void)
{int I,j,k,strl,l;char c;
for(I=0;Ifor(j=0;j{c=xx[I][j];
if ((c>=’A’&&c<=’Z’)||(c>=’a’&&c<=’z’)||c==’ ’)
;
else xx[I][j]=’ ’;
}
for(l=0;l{char ch[80]={0};
char pp[80]={0};
strl=strlen(xx[l]);
I=strl-1;
k=1;
while(1)
{while (((xx[l][I]>=’a’&&xx[l][I]<=’z’)||(xx[l][I]>=’A’&&xx[l][I]<=’z’))&&I>=0)
{for(j=k;j>=0;j--)
pp[j+1]=pp[j];
pp[0]=xx[l][I];
k++;I--;
}
strcat(ch,pp);
strcpy(pp, "");
分页:
上一页 1 2 3 4 5 6 7 8 [9] 10 下一页