分页:
上一页 1 2 3 4 5 6 7 8 9 [10] 下一页
k=1;
if(I==-1)break;
while((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,"");
k=0;
if(I==-1)break;}
strcpy(xx[l],ch);
}}
15、函数ReadDat()的功能是实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中;请编制函数StrOR(),该函数的功能是:以行为单位把字符串中所有小写字母o左边的字符串内容移到该串的右边存放,然后并把小写字母o删除,余下的字符串内容移到已处理字符串的左边存放。最后把已处理的字符串仍按行重新存入字符串数组xx中,最后调用函数WriteDat()把结果xx输出到文件OUT5.DAT中。资料来源:东方教育网http://www.eastedu.com.cn
例如:原文:You can creat an index on any field.
you have the correct record.
结果:n any field. Yu can creat an index
rd.yu have the crrect rec
char xx[50][80];
int maxline=0;/*文章的总行数*/
int ReadDat(void);
void WriteDat(void);
________________________
void StrOR(void)
{int I,j,k,index,strl;
char ch;
for(I=0;I{strl=strlen(xx[I]);
index=strl;
for(j=0;jif(xx[I][j]==’o’)
{for(k=j;kxx[I][k]=xx[I][k+1];
xx[I][strl-1]= ’ ’;
index=j;}
for(j=strl-1;j>=index;j--)
{ch=xx[I][strl-1];
for(k=strl-1;k>0;k--)
分页:
上一页 1 2 3 4 5 6 7 8 9 [10] 下一页