问题 单项选择题

有以下程序段:int n,t=1,s=0;scanf("%d",&n);do{ s=s+t; t=t-2; }while (t!=n); 为使此程序段不陷入死循环,从键盘输入的数据应该是______。

A.任意正奇数

B.任意负偶数

C.任意正偶数

D.任意负奇数

答案

参考答案:D

解析:要使得程序段不陷入死循环,则必须存在终止循环的条件“t=n”,由于 t 的初始值为 1,且每执行 一次循环都会使得 t 的值减 2,故执行本程序后 t 有可能的最大值为-1,然后,依次减 2,所以键盘输入的 n 的值必须是 t 的值之一,即为任意负奇数。

完形填空
An allowance(零花钱)is an important tool for teaching kids how to budget, save and make their own decision. Children remember and learn from mistakes when their own dollars are lost or spent foolishly. 
How large an allowance is appropriate? Experts say there is not a right amount. Actually amounts differ from region to region, and from family to family.
To set an appropriate allowance for your child, work out a weekly budget. Allow for entertainment expenditures(花费) such as movies and snacks. Next, include everyday expenses such as lunch money, bus fare, school supplies. “If you make the child responsible for these bills,” Says Josephine Swanson, a consumer specialist, “he or she will learn to budget for necessary expenditures.”
Finally, add some extra money to make saving possible. If you can, keep your child’s allowance in line with that of his friends. A child whose purchasing power falls away below his peer’s can feel left out.
It can be tough, but avoid excusing your children when they make a mistake with their allowance. When Brooke Stephens was ten, her mother gave her $1, 75% of which for bus fare and lunch. “If you lose your money,” Brooke’s mother told her, “you walk home.”
    One week the girl spent all her allowance in a candy store, then she called home for a ride. “Mom made me walk home.” recalled Stephens, now a financial planner. “ At first I was angry, but I finally realized that she was trying to teach me an important lesson.”
Experts advise that an allowance not be tied directly to child’s daily chores(日常家务).
Kids should help around the house not because they get paid for it but because they share responsibilities as members of a family. You might, however, pay a child for doing extra jobs at home that can develop his or her initiative.
An Allowance
The passage mainly discusses how to teach a child about  1.
As an important tool, an allowance teaches children how to budget, save and make their ___2___.
Josephine Swanson suggests that you should work out a budget for your child  3  .
If you make the child  4  for these bills, he or she will learn to budget for necessary expenditures.”
The author thinks that you should keep your child’s allowance in line with that of  5__.
An  6  of Brook Stephens
Brook’s mum told her that if she lost her money, she  has to  7  .
At first she felt  8 , but she finally realized that her mother was trying to teach her an important lesson.
About child’s daily chores
The author suggests children should  9  the
house and they should realize they are 10___ of a family.
单项选择题