已知在文件IN3.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位)、产品名称mc(字符型10位)、单价dj(整型)、数量sl(整型)、金额je(长整型)五部分组成。其中:金额=单价×数量。函数ReadDat()的功能是读取这 100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品代码从大到小进行排列,若产品代码相同,则:按金额从大到小进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT3.DAT中。 注意:部分源程序已给出。请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。 【试题程序】 #include <stdio.h> #include <memory.h> #include <string.h> #include <conio.h> #include <stdlib.h> #define MAX 100 typedef struet char dm[5]; /*产品代码*/ char mc[11]; /*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ PRO; PRO sell[MAX]; void ReadDat(); void WriteDat() void SortDat() void main) memset(sell,0,sizeof(sell)); ReadDat(); SortDat(); WriteDat(); void ReadDat() FILE *fp; char str[80],ch[11]; int i; fp=fopen("IN3.DAT","r"); for(i=0;i<100;i++) fgets(str,80,fp); memcpy(sell [i] .dm, str,4); memcpy(sell [i] .mc,str+4,10); memcpy(ch, str+14, 4); ch[4]=0; sell [i] .dj=atoi(ch); memcpy(ch,str+18,5);ch[5]=0; selt [i] .sl=atoi(ch); sell [i] .je=(long)sell [i] .dj*sell [i] .sl; fclose(fp); void WriteDat(void) FILE *fp; int i; fp=fopen("OUT3.DAT","w"); for(i=0;i<100;i++) fprintf(fp,"%s %s %4d %5d %101d\n",sell [i] .dm, sell [i] .mc,sell [i] .dj,sell [i] .sl, sell [i] .je); fclose(fp);
第三节 短文理解 2 阅读下列短文,从[A]、[B]、[C]三个选项中选择一个正确答案。 Singapore(新加坡) is the name of an island on the south of Malaya. It is also the name of the cit on the south side of this island. Singapore City is one of the world’s greatest ports. Through it pass goods from all around the world. On most of the island the climate is hot and wet. Fruits, vegetables, and rubber(橡胶) are grown wherever land can be farmed. Malaya is just above Singapore on the map. It is an important shipping center. Much of the rubber that is used in the world is from Malaya. Thick jungles (丛林) cover much of the country. On the little land they can farm, the people raise mostly rice. India is on the west of Burma(缅甸). It is the seventh largest country in the world. And it has more people than any other country except China. India has deserts(沙漠), jungles, plains and mountains. People in India speak about one hundred and eighty languages. On their farms Indians grow wheat, vegetables, rice, and other foods, but they are not able to grow enough food to feed everyone. Which is the seventh largest country in the world
第二节 短文理解 1 阅读下面短文,从[A] (Right)、[B] (Wrong)、[C] (Doesn’t Say)三个判断中选择一个正确选项。 One day a farmer went out for a walk with his little son. The farmer put on a pair of wrong shoes, one with a thick sole (鞋底) and the other with a thin one. So as he began to walk, he felt very uncomfortable (不舒服). When he was just out of the house, he turned to his son and said, "Why should one of my legs be longer than the other today" The son looked at his father’s legs carefully as he was walking and then laughed," Oh, no, Daddy, your legs are all right. You have put on the wrong shoes." The farmer was very happy to hear that and said to himself, "What a clever son I have got!" Then he asked his son to go back and get the other pair of shoes for him. The farmer had only two pairs of shoes. When the son ran back to the house, he found that the other pair was also a pair of wrong shoes. He had to return to his father with nothing in his hands and said out of breath (气喘吁吁地), "It’s no use changing them, Daddy! The shoes at home were not a pair, either!" From the passage, we can see that the son is really very clever.
YOUR BUILDING SERVICE √ We help people in this part of the city by: * checking all plans (方案) before people build new houses or make changes to old ones; * checking water pipes (管道); * looking at any problem buildings and making sure that they are all right. √ We check 900 building plans each year. √ We look at 700 building places each month to see if things are going on well. WHERE CAN YOU GET MORE DETAILS √ The Building Service is at the City Hall, Kenton, CN1 6KJ. Telephone: 676316 or 676317 √ We have office hours for people to come and talk about their problems. HELP US TO HELP YOU √ If you do building work, please think of other people. √ Be nice to people living next door. √ If you want to talk to us about your problems, please give as much detail (细节) as possible. √ If you see any building problems, please let us know right away. WHAT YOU CAN DO IF THINGS GO WRONG √ If you are not happy with us and have anything to say about the Building Service, please come, phone or write to The Planning Office, City Hall, Kenton, CN1 6KJ. Telephone: 676317 "HELP US TO HELP YOU" means ______. [A] sometimes your help is not necessary [B] you can make it easier for us to help [C] usually we cannot help you