问题 填空题

请补充函数fun(),该函数的功能是:判断某一个年份是否为闰年。 例如,1900年不是闰年,2004是闰年。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<conio.h> int fun(int n) { int flag=0; if (n%4=0) { if ( 【1】 ) flag=1; } if ( 【2】 ) flag=1; return 【3】 ; } main() { int year; clrscr(); printf("Input the year:"); scanf("%d", &year); if (fun(year))printf("%d is a leap year. \n", year); elseprintf("%d is not a leap year.\n",year); }

答案

参考答案:[1] n%100!=0或n%100 [2] n%400==0 [3] flag

解析: 填空1:判断闰年的方法是,年份能被4整除但不能被100整除,或者年份能被400整除的是闰年。此空应填, n不能被100整除,即对100取余非零。填空2:年份能被400整除的也是闰年,所以此空应填,n能被400整除,即对400取余为零。填空3:flag标记年份n是否为闰年,当flag为1时是闰年,相反,当flag为0时不是闰年。

完形填空

二、完形填空(10分)

Frederick William I, the King of Prussia, ____31____ that his great gift to the Russian people would have such a strange history. This was the Amber Room, ___32___was given this name because almost seven __33__tons of amber were used to make it. Amber has a beautiful yellow-brown colour. Although it __34__as hard as stone, it easily melt when __35__. Once it is heated, the amber can become any shape. The design for the __36___was __37__ the fancy style popular in those days. The Amber Room was also made with gold and jewels.  It ___38__a team of the country’s best artists ten years to make it. Everyone agreed that it was the best and biggest __39___of amber art ever made. ___40___, in 1941 the Nazi German army stole it.

31. A. could never imagined   B. imagined

C. could have imagined   D. could never have imagined

32. A. which               B. that              C. /               D. who

33. A. thousands of        B. thousand of        C. thousand        D. thousands

34. A. feel                B. feels             C. felt             D. has felt

35. A. heat               B. heated            C. it was heated       D. it has heated

36. A. room              B. house             C. amber             D. thing  

37. A. of                 B. to               C. for              D. in

38. A. spent              B. cost              C. took            D. costs

39. A .job               B. work             C. works           D. gift

40. A. Therefore          B. However          C. but             D. Moreover

单项选择题