问题 单项选择题

标准库函数fgets(s,n,file)的功能是( )。

A.从文件file中读取长度为n的字符串存入字符数组s中

B.从文件file中读取长度不超过n-1个字符的字符串放到字符数组s中

C.从文件file中读取n个字符串存入字符数组s中

D.从文件file中读取长度为n-1个字符的字符串存入字符数组s中

答案

参考答案:B

解析: 字符串输入函数fgets()的调用形式为:fgets(s,n,fp)。fgets函数参数说明:“s”可以是一个字符数组名,也可以是指向字符串的指针;“n”为要读取的最多的字符个数;“fp”是指向该文件的文件型指针。
fgets函数的功能:从fp所指向的文件中读取长度不超过n-1个字符的字符串,并将该字符串放到字符数组s中;读入字符串后会自动在字符串末尾加入“'\0'”结束符,表示字符串结束。

单项选择题

The fridge is considered a necessity. It has been so since the 1960s when packaged food first appeared with the label: "store in the refrigerator. "
In my fridgeless fifties childhood, I was fed well and healthy. The milkman came daily, the grocer, the butcher, the baker, and the ice cream man delivered two or three times a week. The Sunday meat would last until Wednesday and surplus bread and milk became all kinds of cakes. Nothing was wasted, and we were never troubled by rotten food. Thirty years on, food deliveries have ceased, fresh vegetables are almost unobtainable in the country.
The invention of the fridge contributed comparatively little to the art of food preservation. A vast way of well tried techniques already existed—natural cooling, drying, smoking, salting, sugaring, bottling…
What refrigeration did promote was marketing—marketing hardware and electricity, marketing soft drinks, marketing dead bodies of animals around the globe in search of a good price.
Consequently, most of the world’s fridges are to be found, not in the tropics where they might prove useful, but in the wealthy countries with mild temperatures where they are climatically almost unnecessary. Every winter, millions of fridges hum away continuously, and at vast expense, busily maintaining an artificially cooled space inside an artificially heated house—while outside, nature provides the desired temperature free of charge.
The fridge’s effect upon the environment has been evident, while its contribution to human happiness has been insignificant. If you don’t believe me, try it yourself, invest in a food cabinet and turn off your fridge next winter. You may miss the hamburgers, but at least you’ll get rid of that terrible hum.

Who benefited the least from fridges according to the author

A.Inventors
B.Consumers
C.Manufacturers
D.Traveling salesmen

多项选择题