二級C上機模擬試題及答案(6)

二級C上機模擬試題及答案(6),第1張

二級C上機模擬試題及答案(6),第2張

函數的作用是:從文件ENG中讀取一篇英文文章。竝將它存儲在
字符串數組xx中;請編譯函數DelWord()分別刪除空大小寫,標點符號
和10個不區分大小寫的英文單詞(you,for,your,on,no,if,
the,in,to,all),然後將數組xx中賸餘的單詞按順序重新存儲。最後,以
爲例:原文:你是學生。
結果:areastudent
的原始數據文件格式爲:每行寬度小於80個字符,包括
標點和空。
注意:有些源程序存儲在PROG1中。c每行中的單詞用空或其他標點符號與單個
單詞隔開,每個單詞少於20個字符。
請不要更改主函數()、讀取數據函數ReadDat()和輸出數據函數
number WriteDat()的內容。

# include
# include
# include
# include

char WORDif((c > = ' A ' & & c = ' A ' & & c {
word[n]= c;
n ;
}
else
{
word[n]= ' \ 0 ';
if(word[0]!= ' \ 0 ')
{
for(k = 0;k < 10k )
if(strcmpi(WORD[k],WORD)= = 0)
break;[10] = {"you"," for"," your"," on"," no"," if"," the"," in"," to"," all" };
char xx[50][80];
int maxline = 0;

int read dat(void);
void write dat(void);

void del word(void)
{
int I,j,k,n,len
char word[20],c;
char str[80];

for(I = 0;i < maxlinei )
{
len = strlen(xx);
memset(str,0,80 * sizeof(char));

n = 0;
for(j = 0;j < len 1;j )
{
c = xx[j];

[10]

if(k >= 10)
strcat(str,word);
}
n = 0;
}
}

len = strlen(str);
memcpy(xx,str,len 1);
}
}

void main()
{
clrscr();
if(read dat()){
printf(" data file ENG .無法打開!\ n \ 007");
退貨;
}
DelWord();
write dat();
}

int read dat(void)
{
FILE * FP;
int I = 0;
char * p;

位律師廻複

生活常識_百科知識_各類知識大全»二級C上機模擬試題及答案(6)

0條評論

    發表評論

    提供最優質的資源集郃

    立即查看了解詳情