问题 填空题

数组xx[N]保存着一组3位数的无符号正整数,其元素的个数通过变量num传入函数fun()。请补充函数fun(),该函数的功能是:从数组xx中找出个位和百位的数字相等的所有无符号整数,结果保存在数组yy中,其个数由函数fun()返回。
例如:当xx[8]=135,78,72,32,222,424,333,141,541时, bb[6]=787,232,222,424,333,141。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include <conio.h>
#define N 1000
int fun(int xx[],int bb[],int num)

int i,n=0;
int g,b;
for(i=0;i<num;i++)

g= 【1】
b=xx[i]/100;
if(g==b)
【2】

return 【3】

main()

int xx[8]=135,787,232,222,424,333,
141,541;
int YY[N];
int num=0,n=0,i=0;
num=8;
clrscr();
printf("*** original data ***\n");
for(i=0;i<num;i++)
printf("%u",xx[i]);
printf("\n\n\n");
n=fun(xx,yy,num);
printf("\nyy=");
for(i=0;i<n;i++)
printf("%u",YY[i]);

答案

参考答案:【1】xx[i]%10 【2】bb[n++]=xx[i] 【3】n

解析:填空1:变量b存放了三位数的百位数字,所以变量g应该存放三位数的个位数字,将这个三位数对10求余,则得到这个数的个位数字。填空2:将个位数字与百位数字相等的整数存于数组bb中。填空3:变量n记录了个位数字等于百位数字的整数的个数,题目要求个数由函数fun()返回,所以应返回n。

阅读理解

阅读理解。

     David Moore taught science at the City School. He needed some expensive books, so he bought

them. He put the books in his car in a quiet street. Then he went to other shops to buy something else. At

six he carne back to the car. One door was open-and the books were not there. David drove home. 

     That night he wrote a letter to a newspaper. The next day he went to the police station.  

     On Friday people read this in the newspaper :  

     Books:Have you any old books? I buy old and modern books.

     Open all day on Saturday.Dauid Moore.26 Fry Road.

     David stayed at home on Saturday. The first man came at eight. David took him to the kitchen. At half past nine another man arrived. He had a bag under his arm. 

     "Mr. Moore?”the man asked. 

     "That’s right,”David said.“Can I help you?” 

     "I’ve got some good books. You buy books, don’t you?” 

     "Yes.Bring them in.Let me have a look.” 

     Soon the books were on the dining-table.“Come in now.”David called,“and bring the list.”

     A policeman came into the dining-room.He read the names on the books and the names on the list in his hand. They were the same.

     "Come with me.Sir.”the policeman said to the man.

1. What happened to David Moore one day?

A. He lost his wav in the city.

B. He couldn’t find his car.

C. Someone stole(偷)his books.

D. Many people read his letter.

2. The first man to David’s home was a_________.

A. thief(小偷)

B. policeman

C. driver

D. cook 

3. From the story,we know the second man_______.

A. is one of David’s friends

B. wants to return the books to David

C. want s to show the books to David

D. read the newspaper 

4. Which of the following shows the right order of what happened to David?

a. He left his car in a quiet street.        b. He went to the police station.

c. He wrote a letter to a newspaper.  d. He bought some dear books.

e. He bought something else at other shops.

A. a, b, c, d, e

B. e, d, c, a, b

C. d, a, e, c, b

D. c, d, e, a, b 

5. David probably(可能)bought the books on________.

A. Wednesday

B. Friday

C. Saturday

D. Sunday

单项选择题