第一篇:高中英语复习英语翻译一百题
班级_______________ 姓名________________ 学号___________
1.我们必须不断学习,这样才能与时俱进。(so that)
2.意大利足球队非常强调团队精神,这是他们赢得世界杯的关键。(1ay emphasis on)
3.她不声不响离家出走,使她的父母心烦意乱。(without)
4.小男孩对展览会上的那辆汽车很着迷。(fascinate)
5.使刘翔迷们感到兴奋的是,刘翔在瑞士洛桑创造了12秒88的男子110米栏的世界纪录。(To„)
6.我最后一次看见杰克的时候,他一个人在街上走。(The last time)
7.几乎每一个人都承认犯罪不可能被彻底消灭。(the fact,wipe out)
8.如果公众失去了对这家公司的信任,那么他们的销售会下降得很快。(1ost trust)
9.给我印象最深的是磁悬浮列车的速度是多么的快啊。(impress,magnetic suspension train)
10.我爸爸不愿用新手机来替换他那只磨损不堪的老手机。(substitute)
11.尽管天气很寒冷,学生们还是在6点正准时出操。(Despite)
12.每个人,不管是年轻人还是老年人都应铭记“骄者必败”。(keep)
13.虽然他们是好朋友,但他不愿意帮助修理电脑。(reluctant)
14.那位脸色苍白的妇女站在大楼顶上,这使在场的人都很担心。(at the top of)
15.他必定是这次竞赛中最可能获奖的学生。(likely)
16.在我陷于困境时,对于你的帮助我表示万分感激。(grateful)
17.这所学校在艺术教育方面建立了很好的声誉。(reputation)
18.她放弃了这次机会仅仅是因为缺少足够的钱。(1ack)
19.这个到2009年末完成的项目将使我们在半个小时内就能到达杭州。(不定式)
20.那男孩是如此的调皮,他奶奶对他束手无策。(so„that)
21.你说的也就是我所想的。(what)
22.不管他父亲是否同意,他将选择教师作为他的职业。(whether)
23.根据他提供的线索,警察很快抓到了逃犯。(according)
24.当你们到达那里时,你们会知道他发生了什么事。(the moment)
25.不要把今天的事留到明天做。(名词性从句)
26.这儿就是上星期你们找到那个失踪的男孩的地方吗?(强调句)
27.任何违反了规则的人都要受到处罚。(whoever)
28.在俄罗斯飞机失事的事故中,有50多位乘客死亡,包括2位中国公民。(including)
29.很显然他与昨天发生的事毫无关系。(it is)’
30.为了减轻学习的压力,看小说是我的第一选择。(非谓语)
31.他不可能在一星期内找到那位已有10年没有联系的朋友。(chance)
32.他应受惩罚,是他撬开门的。(deserve)
33.她和她既诚实又勤劳的父母一点儿也不像。(similar)
34.他的学习态度和他父母对他的严格要求有关。(relate)
35.我家离上海大剧院只有一箭之遥。(within)
36.在场的每一位同学对他的态度都非常不满。(present)
37.我们不得不尽一切方法来削减建设项目的成本。(means)
38.任何先给我们打电话的人将得到上海博物馆的免费票。(被动句)
39.随着电脑的发明,人们可以通过电子邮件来保持联系。(by means 0f)
40.众所周知,中华民族是个勤劳、勇敢的民族。(as)
41.尽管这本书很值得买,但对于其昂贵的价格我犹豫了很长时间。(worth)
42.使用e-mail,我觉得与朋友的交往更加方便了。(it作形式宾语)
43.他的勤奋可以弥补他工作经验的不足。(make up)
44.要是当时我谨慎些,现在就不会有麻烦。(虚拟语气)
45.迄今为止,我还没有找到一个更好的办法来阻止我姐姐嫁给那位有钱的老头。(prevent)
46.由于他的粗心大意,他应对这次交通事故负责。(blame)
47.只有老师在场时,他才是一位诚实的孩子。(only)
48.他把一生都奉献给了教育事业,对此我们感到非常敬佩。(devote„t0„)
49.这支救援队由12名医生和30名护士组成。(consist)。
50.人们总是抱怨晚上建筑工地上的噪音太大。(complain)
51.世界上没有任何一个其他国家的人口有中国这么多。(population)
52.昨天我打电话找你,但没人接。(answer)
53.现在讨论谁对谁错是没有意义的。(point)
54.他的学识胜过班上任何一位同学。(superior)
55.死刑(capital punishment)仍然在包括美国在内的许多国家中使用。(in use)
56.这项工作不仅需要知识还需要工作经历。(as well as)
57.要是我早知道他能帮我解决这个难题就好了。(If only)
58.他不可能去了北京,因为今天上午我刚在学校碰见他。(can’t have done)
59.尽管他退休已经好几年了,他仍然致力于他所热爱的教育工作。(as,devote)
60.要是薪水不是太低,我就会接受这项工作。(unless)
61.发现号航天飞机上的成员在12月修好了哈勃(Hubble)望远镜。(crew)
62.了解自己心理上的需求很重要,因为它们会强烈影响你的选择。(affect)
63.本月初,大卫被授予“年度之星"的称号。(title)
64.听到她被选为班长的消息,她的脸上喜气洋洋。(1ight)
65.昨天现场直播的足球赛吸引了3千万观众。(live)
66.年轻人可能更喜欢通俗歌曲,而不是经典音乐。(be likely to)
67.是去年他接受的训练使他取得了成功。(1ead to)
68.他不愿对老师的任何话都听从。(whatever)
69.此外,当时还有一位穿着破夹克的年轻人在现场。(in addition)
70.在年轻人中,以不吃中饭来减肥的想法很流行。(skip)
71.我班有48位学生,其中30位是女生。(定语从句)
72.我想自己解这道难题而不是要他帮助。(rather than)
73.刘星以100岁的高龄去年第一次来到上海。(visit t0)
74.“抓周(zhua zhou),是中国的传统风俗,不同的选择代表孩子不同的将来。(stand for)
75.如果我是蝙蝠侠(Spiderman),我就不怕一个人晚上外出了。(虚拟语气)
76.为了提高你孩子的记忆力,你应该鼓励你的孩子学习一些短的诗歌。(encourage)
77.那些为国家做出了巨大贡献的人值得我们尊敬。(make contributions to)
78.他一直渴望去北京的愿望终于实现了。(look forward to)
79.这场足球赛很乏味?正当我要关电视机时,中国队进球了。(be about to)
80.在那种情况下,我是不会单独和你外出的。(case)
81.他父母对他成功进入复旦大学而感到骄傲。(proud)
82.她对她儿子太宠爱了,经常不能察觉他的过错。(be blind to).
83.有消息说她将在九月份去澳大利亚。(同位语)(word)
84.会议持续了3个小时,但他们还没有做出决定。(arrive at)
85.她心烦意乱,因为她女儿生下来就是瞎子。(upset)
86.他向中央电视台台长抱怨节目中频繁的广告。(complain)
87.如果你明天不去图书馆,我也不去。(neither)
88.世界上再没有这样美丽恬静的地方了。(用nowhere开头)
89.我不愿坐在这里无所事事,咱们去打篮球好吗?(feel like)
90.同众人一样,你很快就会得出下个结论:最便宜、最可靠的交通方式就是你的双腿。(come to a conclusion)
91.我们希望人人都能享受到免费医疗服务。(available)
92.他的计划听起来很好,但实施起来并不容易。(carry)
93.我本来想解释缺席的原因,但不知如何开口。(at a loss)
94.每次考试时,我都感到特别紧张。(Every time……)
95.他为促进世界和平做出了重大贡献,应该受到诺贝尔和平奖。(award)
96.正是由于缺乏安全意识才导致了一次又一次的矿难(mine disaster).(It was…that…)
97.从这家旅馆可以看到庐山山谷景色很优美。(outlook)
98.要使我们的城市天更蓝、地更绿、水更清,我们还得做大量的工作。(A lot, make)
99.很多出国留学的年轻人并不理会国外给他们提供的优惠条件,毅然回来参加祖国建设。(without hesitation)
100.据报道,新建的高速公路很宽,足以让汽车成六排并列行驶,来回方向各有三个车道。(enough)
Translation:
1.We should/ must continue to learn more so that we can keep pace/up with the development of times.2.The Italian Football Team laid great emphasis on team spirit, which was the key to winning the World
Cup.3.Her leaving home without saying a word upset her parents.4.The little boy was fascinated by the car on the exhibition.5.To his fan’s excitement, Liu Xiang set a new world record of 12.88 seconds in the men’s 110-metre
hurdles in Lausanne, Switzerland.6.The last time I saw Jack, he was walking down the street alone.7.Almost everyone accepts the fact that crime can never be wiped put entirely.8.If the public lose trust in the company, sales will fall sharply.9.What impressed me most is how fast the speed of a magnetic suspension train is.10.My father isn’t willing to substitute the new cell phone for his worn-out one.11.Despite the cold weather, the students did morning exercises at 6 o’clock sharp.12.Everyone, young or old, must keep in mind that pride goes before a fall.13.Though they are close friends, he is reluctant to help fix the computer.14.At the top of the building stood a woman whose face was pale, which frightened everyone on the scene.15.He is sure to be the most likely student to win the prize in the competition.16.I’m deeply grateful to you for your help, when I was in trouble.17.The school has built up a good reputation in art education.18.She gave up the chance merely because of her lacking enough money.19.The project to be accomplished by the end of 2009 will enable us to reach Hangzhou in 30 minutes.20.The boy was so naughty that his grandmother didn’t know how to deal with him.21.What you said was just what I thought.22.Whether his father agrees or not, he will choose teacher as his career.23.According to the clues given by him, the police soon arrested the escaped criminal.24.The moment you get there, you’ll(surely)know what has happened to him.25.Don’t leave for tomorrow what you can do today.26.Where is it that you found the missing boy last week?
27.Whoever breaks the rules will be punished.28.50 passengers were killed in the air crash in Russia, including 2 Chinese citizens.29.It is obvious that he has nothing to do with the incident that happened yesterday.30.Reading novels is my first choice in order that I can reduce the pressure of the study.31.There is no chance that he will find the friend who hasn’t been kept in touch for ten years in a week.32.He deserved punishment/to be punished/punishing, for it was he who broke the door.33.She isn’t a bit similar to her parents, who are honest and hardworking.34.His study attitude is related to his parents being strict to him.35.My house is within a stone’s throw of Shanghai Grand Theatre.36.Every student present wasn’t satisfied with his attitude.37.We have to try every means to cut down the costs of the construction project.38.Free Shanghai Museum tickets will be sent to whoever phones us first.39.With the invention of the computer, people can keep in touch with each other by means of emails.40.As is known to all, Chinese is a diligent and brave nation.41.Though the book was worth buying, I hesitated for long because of its high price.42.Using e-mail, I found it more convenient to communicate with my friends.43.His diligence can make up for his lack of working experience.44.If I had been more careful at that time, I would not be in trouble now.45.So far, I haven’t found a better way to prevent my sister marring the rich old man.46.He is to blame for the traffic accident because of his carelessness.47.Only when the teacher was present was he an honest boy.48.We admire that he has devoted all his life to the cause of education.49.The rescue team consists of 12 doctors and 30 nurses.50.People always complain that there is too much noise on the construction site at night.51.The population of any other country in the world is not so large as that of China.52.I phoned you yesterday, but no one answered.53.There is no point in discussing who is right or who is wrong.54.He is superior in knowledge to any other student in our class.55.Capital punishment remains in use in many countries including the United States.56.This job requires working experiences as well as knowledge.57.If only I had known that he could help me solve the problem.58.He couldn’t have gone to Beijing, for I saw him at school this morning.59.Retired as he has been for years, he still devotes himself to the education which he loves.60.I will accept the job unless the salary is too low.61.The crew of the Space Shuttle Discovery repaired the Hubble telescope in December.62.Knowing you own psychological needs is important, because they strongly affect our choices.63.Early this month, David was awarded the title “Star of the Year.”
64.Her face lighted up when she heard the news that she was elected monitor.65.The football match, which attracted an audience of 30,000,000 was televised live.66.Young men are more likely to like pop songs than classical music.67.It was the training that he received last year that led to his success.68.He is unwilling to follow whatever his teachers say.69.In addition, there was a young man wearing a worn-out jacket on the scene at that time.70.The idea of kipping lunch so as to lose weight is very popular among the youngsters.71.There are forty-eight students in our class, thirty of whom are girls.72.I want to work out the difficult problem myself rather than ask him for help.73.Liu Xing made his first visit to Shanghai last year at the age of 100.74.“Zhua Zhou” is a traditional Chinese custom, and different choices can stand for various futures.75.If I were Spiderman, I wouldn’t be afraid of going out alone at night.76.To improve your child’s memory, you should encourage him /her to learn some short poems.77.Those who made great contributions to the country deserve our respect.78.His desire to pay a visit to Beijing that he was looking forward to finally came true.79.The football match was boring, but when I was about to turn off the TV.Chinese goaled.80.I wouldn’t go out with you alone in that case.81.His parents are proud of his succeeding in entering Fudan University.82.She spoils her son so much that she is always blind to his mistakes.83.Word came that she would go to Australia in September.84.The meeting lasted for 3 hours, but they still didn’t arrive at a decision.85.She was upset, for her daughter was born blind.86.He complained to the president of CCTV for frequent advertisements in programs.87.If you don’t go to the library tomorrow, neither shall I.88.Nowhere else in the world can be such a quiet, beautiful place.89.I don’t like sitting here doing nothing.Shall we go to play basketball?
90.Like many people, you may come to a conclusion that the most inexpensive(cheapest)and reliable form
of transportation(travel)will be our own legs.91.We wish that free medical service would be available to everyone.92.His plan sounds great, but it is not easy to carry it out.93.I had wanted to explain my absence, but I was at a loss what to say.94.Every time I have an exam, I am always feeling nervous.95.As he has made great contributions to world peace, he should be awarded the Nobel Prize for peace.96.It was lack of the sense of security that led to one mine disaster after another.97.The hotel has a pleasant outlook over the valley of Mount Lu.98.A lot is still to be done to make the sky of our city bluer, the land greener and the water cleaner.99.Many young people who had studied abroad took little notice of the favorable terms offered by some
countries and came back to build the motherland without hesitation.100.It is reported that the newly-built expressway is wide enough for 6 lanes of cars to drive side by side,three in each direction.
第二篇:南开一百题
1、请编写一个函数jsValue(int m,int k,int xx[]),该函数的功能是:将大于整数m且紧靠m的k个素数存入数组xx传回。
最后调用函数writeDat()读取10组数据,分别得出结果且把结果输出到文件out.dat中。
部分源程序存在文件prog1.c中。
例如:若输入17 5 则应输出:19,23,29,31,37。
请勿改动主函数main()和写函数writeDat()的内容。#include
int isP(int m){ int i;
for(i=2;i if(m % i==0)return 0;return 1;} void num(int m,int k,int xx[]){ int s=0; for(m=m+1;k>0;m++) if(isP(m)){ xx[s++]=m;k--;} } main(){ int m,n,xx[1000]; clrscr(); printf(“nPlease enter two integers:”); scanf(“%d%d”,&m,&n); num(m,n,xx); for(m=0;m printf(“%d ”,xx[m]); printf(“n”); readwriteDat();} void readwriteDat(){ int m,n,xx[1000], i;FILE *rf,*wf; rf=fopen(“in.dat”,“r”);wf=fopen(“out.dat”,“w”);for(i=0;i<10;i++){ fscanf(rf,“%d %d”,&m,&n); num(m,n,xx); for(m=0;m fprintf(wf,“n”);} fclose(rf);fclose(wf);} 无忧id 14题(无isP()函数)#include void jsValue(int m,int k,int xx[]){ int i,j,s=0; for(i=m+1;k>0;i++) { for(j=2;j if(i%j==0)break; if(i==j){ xx[s++]=i;k--;} } } main(){ int m,n,zz[100]; printf(“n请输入两个整数:”);scanf(“%d%d”,&m,&n);jsValue(m,n,zz);for(m=0;m writeDat(){ int m,n,zz[100],i;FILE *in,*out; in=fopen(“in.dat”,“r”);out=fopen(“out.dat”,“w”);for(i=0;i<10;i++){ fscanf(in,“%d%d”,&m,&n); jsValue(m,n,zz); for(m=0;m fprintf(out,“n”); } fclose(in);fclose(out);} 另一解法: void num(int m,int k,int xx[]){ int n=0,data=m+1;while(n 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:如果四位数各位上的数字均是0或2或4或6或8,则统计出满足此条件的个数cnt,并把这些四位数按从大到小的顺序存入数组b中。最后main()函数调用写函数writeDat()把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 注意:部分源程序存在文件prog1.c中。 程序中已定义数组:a[200],b[200],已定义变量:cnt 请勿改动数据文件IN.DAT中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。#include void jsVal(){ int i,j,qw,bw,sw,gw; for(i=0;i { qw=a[i]/1000;bw=a[i]/100%10; sw=a[i]%100/10;gw=a[i]%10; if(qw&&qw%2==0&&bw%2==0&&sw%2==0&&gw%2==0)b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i] void readDat(){ int i; FILE *fp; fp = fopen(“in.dat”, “r”); for(i = 0;i < MAX;i++)fscanf(fp, “%d”, &a[i]); fclose(fp);} void main(){ int i; readDat(); jsVal(); printf(“满足条件的数=%dn”, cnt); for(i = 0;i < cnt;i++)printf(“%d ”, b[i]); printf(“n”); writeDat();} writeDat(){ FILE *fp; int i; fp = fopen(“out.dat”, “w”); fprintf(fp, “%dn”, cnt); for(i = 0;i < cnt;i++)fprintf(fp, “%dn”, b[i]); fclose(fp);} ★题目3(无忧 id 133题;捷成id 59、99题) 函数ReadDat()实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中;请编制函数StrOR(),其函数的功能是:以行为单位依次把字符串中所有小写字母o左边的字符串内容移到该串的右边存放,然后把小写字母o删除,余下的字符串内容移到已处理字符串的左边存放,之后把已处理的字符串仍按行重新存入字符串数组xx中。最后main()函数调用函数WriteDat()把结果xx输出到文件OUT5.DAT中。 例如:原文:n any field.Yu can create an index you have the correct record.结果:n any field.Yu can create an index rd.yu have the crrect rec 原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。 注意:部分源程序存放在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include char xx[50][80];int maxline = 0;/* 文章的总行数 */ int ReadDat(void);void WriteDat(void); void StrOR(void){int i,righto,j,s,k;char tem[80];for(i=0;i for(j=strlen(xx[i])-1;j>=0;j--) { k=0; memset(tem,0,80);/*初始化字符串数组tem*/ if(xx[i][j]=='o')/*如果当前字符为'o',进入以下语句*/ {righto=j;/*则将此字符中位置j的值赋给righto*/ for(s=righto+1;s tem[k++]=xx[i][s];/*从righto的下一跳开始将其后所有的字符都存入到tem中*/ for(s=0;s if(xx[i][s]!='o')tem[k++]=xx[i][s];/*将不是字符'o'的字符全存入到tem中*/ strcpy(xx[i],tem);/*将当前已处理的字符重新存入当前行xx*/ } else continue; } } void main(){ clrscr(); if(ReadDat()){ printf(“数据文件IN.DAT不能打开!n 07”); return; } StrOR(); WriteDat();} int ReadDat(void){ FILE *fp; int i = 0; char *p; if((fp = fopen(“IN.DAT”, “r”))== NULL)return 1; while(fgets(xx[i], 80, fp)!= NULL){ p = strchr(xx[i], 'n'); if(p)*p = 0; i++; } maxline = i; fclose(fp); return 0;} void WriteDat(void){ FILE *fp; int i; clrscr(); fp = fopen(“OUT5.DAT”, “w”); for(i = 0;i < maxline;i++){ printf(“%sn”, xx[i]); fprintf(fp, “%sn”, xx[i]); } fclose(fp);} 解法二: void StrOR(void){ int i; char a[80],*p; for(i=0;i { p=strchr(xx[i],'o'); while(p) { memset(a,0,80); memcpy(a,xx[i],p-xx[i]); strcpy(xx[i],p+1); strcat(xx[i],a); p=strchr(xx[i],'o'); } } } 解法三: void StrOR(void){ int i, j; char yy[80], *p; for(i=0;i for(j=0;j if(xx[i][j]=='o') { memset(yy, 0, 80); p=&xx[i][j+1]; strcpy(yy, p);/*将指针p所指向的字符串拷贝到字符串yy中去*/ strncat(yy, xx[i], j);/*将字符串xx[i]中前j个字符连接到yy中*/ strcpy(xx[i], yy);/*将字符串yy重新拷贝到字符串xx[i]中去*/ j=0;/* 开始下一次的扫描*/ } } ★题目4(无忧id 24题 捷成id 9题)函数ReadDat()实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中,请编制函数StrOL(),其函数的功能是:以行为单位对行中以空格或标点符号为分隔的所有单词进行倒排。最后把已处理的字符串(应不含标点符号)仍按行重新存入字符串数组xx中,最后调用函数writeDat()把结果xx输出到文件OUT6.DAT中。 例如:原文:You He Me I am a student.结果:Me He You student a am I 原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数writeDat()的内容。#include char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); /*在无忧及捷成版模拟系统中都通过测试(输入文件句末有标点的在输出文件中句前有空格*/ void StrOL(void){ int i,j,k,s,m,strl; char str[80]; for(i=0;i { strl=strlen(xx[i]); memset(str,0,80);/*初始化这字符串数组str*/ s=k=0; for(j=strl-1;j>=0;j--)/*从当前字符串尾部开始向前倒序循环,实现题意要求的倒排*/ { if(isalpha(xx[i][j]))k++;/*如果当前字符是字母a~z或A~Z,则k加一*/ else { for(m=1;m<=k;m++)/*否则将长度为k的单词顺序存入到字符串数组str中,s值加1*/ str[s++]=xx[i][j+m]; k=0;/*将k值清0,以方便下一个单词的长度计数*/ } if(!isalpha(xx[i][j]))str[s++]=' ';/*如果当前字符不是字母a~z或A~Z,则以空格代之存入到字符串数组str中,s值加一*/ } for(m=1;m<=k;m++)/*此时的k值为当前字符串中第一个单词的长度,但在上一个for循环中没能存入到字符串数组str中,所以在这里将其存入到str中*/ str[s++]=xx[i][j+m]; str[s]=' ';/*在当前行尾加0以标记此行的结束*/ strcpy(xx[i],str);/*将倒排好的当前字符串重新存回到当前行xx中*/ } } void main(){ clrscr();if(ReadDat()){ printf(“数据文件IN.DAT不能打开!n 07”); return;} StrOL();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;char *p; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; clrscr();fp=fopen(“OUT6.DAT”,“w”);for(i=0;i printf(“%sn”,xx[i]); fprintf(fp,“%sn”,xx[i]);} fclose(fp);} 另一解法(): /*在无忧及捷成版模拟系统中都通过测试(输入文件句末有标点的在输出文件中句前有空格*/ void StrOL(void){ int i,j,m;char str[80];for(i=0;i for(j=m-1;j>=0;j--)if(!isalpha(xx[i][j])){ strcat(str,xx[i]+j+1);strcat(str,“ ”);xx[i][j]=' ';} strcat(str,xx[i]); strcpy(xx[i],str);} } ★题目5(无忧id 8题) 在文件in.dat中有200个正整数,且每个数均在1000至9999之间。函数ReadDat()读取这200个数存放到数组aa中。请编制函数jsSort(),其函数的功能是:要求按每个数的后三位的大小进行升序排列,然后取出满足此条件的前10个数依次存入数组bb中,如果后三位的数值相等,则按原先的数值进行降序排列。最后调用函数WriteDat()把结果bb输出到文件out.dat中。 例:处理前 6012 5099 9012 7025 8088 处理后 9012 6012 7025 8088 5099 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include int aa[200],bb[10]; void jsSort(){ int i,j,data;for(i=0;i<199;i++) for(j=i+1;j<200;j++) if(aa[i]%1000>aa[j]%1000||aa[i]%1000==aa[j]%1000&&aa[i] {data=aa[i];aa[i]=aa[j];aa[j]=data;} for(i=0;i<10;i++) bb[i]=aa[i];} void main(){ readDat();jsSort();writeDat();} readDat(){ FILE *in; int i; in=fopen(“in.dat”,“r”); for(i=0;i<200;i++)fscanf(in,“%d,”,&aa[i]); fclose(in); } writeDat(){ FILE *out;int i; clrscr();out=fopen(“out.dat”,“w”);for(i=0;i<10;i++){ printf(“ %d”,bb[i]); fprintf(out,“%dn”,bb[i]);} fclose(out);} 题目6 题目6:在文件in.dat中有200个正整数,且每个数均在1000至9999之间。函数ReadDat()读取这200个数存放到数组aa中。请编制函数jsSort(),其函数的功能是:要求按每个数的后三位的大小进行降序排列,然后取出满足此条件的前10个数依次存入数组b中,如果后三位的数值相等,则按原先的数值进行升序排列。最后调用函数WriteDat()把结果bb输出到文件out.dat中。 例:处理前 9012 5099 6012 7025 8088 处理后 5099 8088 7025 6012 9012 注意:部分源程序已给出。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。 #include int aa[200],bb[10]; void jsSort(){ int i,j,data;for(i=0;i<199;i++) for(j=i+1;j<200;j++) if(aa[i]%1000 {data=aa[i];aa[i]=aa[j];aa[j]=data;} for(i=0;i<10;i++) bb[i]=aa[i];} void main(){ readDat();jsSort();writeDat();system(“pause”);} readDat(){ FILE *in;int i; in=fopen(“in.dat”,“r”);for(i=0;i<200;i++)fscanf(in,“%d,”,&aa[i]); fclose(in);} writeDat(){ FILE *out;int i;clrscr();out=fopen(“out.dat”,“w”);for(i=0;i<10;i++){ printf(“i=%d,%dn”,i+1,bb[i]);fprintf(out,“%dn”,bb[i]);} fclose(out);} ★题目7(无忧id 15题) 已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),数量sl(整型),金额je(长整型)五部分组成。其中:金额=单价*数量计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品代码从大到小进行排列,若产品代码相同,则按金额从大到小进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT6.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include #define MAX 100 typedef struct{ char dm[5];/*产品代码*/ char mc[11];/*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ }PRO;PRO sell[MAX];void ReadDat();void WriteDat(); void SortDat(){int I,j;PRO xy;for(I=0;I<99;I++) for(j=I+1;j<100;j++) if(strcmp(sell[I].dm,sell[j].dm)<0||strcmp(sell[I].dm,sell[j].dm)==0&&sell[I].je {xy=sell[I];sell [I]=sell[j];sell[j]=xy;} } void main(){ memset(sell,0,sizeof(sell));ReadDat();SortDat();WriteDat();} void ReadDat(){ FILE *fp;char str[80],ch[11];int i; fp=fopen(“IN.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; sell[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(“OUT6.DAT”,“w”);for(i=0;i<100;i++){ printf(“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);fprintf(fp,“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);} fclose(fp);} ★题目8(无忧id 83 字符替换题) 函数ReadDat()实现从文件ENG.IN中读取一篇英文文章,存入到字符串数组xx中;请编制函数encryptChar(),按给定的替代关系对数组xx中的所有字符进行替代,仍存入数组xx的对应的位置上,最后调用函数WriteDat()把结果xx输出到文件PS1.DAT中。 替代关系:f(p)=p*11 mod 256(p是数组中某一个字符的ASCII值,f(p)是计算后新字符的ASCII值),如果计算后f(p)值小于等于32或大于130,则该字符不变,否则将f(p)所对应的字符进行替代。部分源程序存在文件prog1.c中。原始数据文件存放的格式是:每行的宽度均小于80个字符。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include unsigned char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void encryptChar(){ int i,j; for(i=0;i for(j=0;j if(xx[i][j]*11%256<=32||xx[i][j]*11%256>130)continue; else xx[i][j]=xx[i][j]*11%256;} void main(){ clrscr();if(ReadDat()){ printf(“数据文件ENG.IN不能打开!n 07”); return;} encryptChar();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;unsigned char *p; if((fp=fopen(“eng.in”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; fp=fopen(“ps1.dat”,“w”);for(i=0;i printf(“%sn”,xx[i]); fprintf(fp,“%sn”,xx[i]);} fclose(fp);} 解法二: void encryptChar(){ int i,j,k; for(i=0;i if(k<=32||k>130)continue; else xx[i][j]=k; } } 解法三: void encryptChar(){ int i,j;unsigned char ch;for(i=0;i 解法四: void encryptChar(){ int i,j;char *p;for(i=0;i 解法五: void encryptChar(){ int i;char *pf;for(i=0;i { pf=xx[i]; while(*pf!=0) if(*pf*11%256<=32||*pf*11%256>130)pf++; else *pf++=*pf*11%256; } } ★题目9(无忧id 28;id 124题;捷成id 16题) 函数ReadDat()实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中,请编制函数SortCharD(),其函数的功能是:以行为单位对字符按从大到小的顺序进行排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数writeDat()把结果xx输出到文件OUT2.DAT中。 例:原文:dAe,BfC.CCbbAA 结果:fedCBA.bbCCAA 原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数writeDat()的内容。#include char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void SortCharD(void){int I,j,k,strl;char ch;for(I=0;I {strl=strlen(xx[I]); for(j=0;j for(k=j+1;k if(xx[I][j] } } void main(){ clrscr();if(ReadDat()){ printf(“数据文件IN.DAT不能打开!n 07”); return;} SortCharD();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;char *p; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; fp=fopen(“OUT2.DAT”,“w”);for(i=0;i 函数ReadDat()实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中,请编制函数ConvertCharA(),其函数的功能是:以行为单位把字符串中的所有小写字母改写成该字母的下一个字母,如果是字母z,则改写成字母a。大写字母仍为大写字母,小写字母仍为小写字母,其他字符不变。把已处理的字符串仍按行重新存入字符串数组xx中,最后调用函数writeDat()把结果xx输出到文件OUT1.DAT中。 例:原文:Adb.Bcdza abck.LLhj 结果:Aec.Bdeab bcdl.LLik 原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数writeDat()的内容。#include char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void ConvertCharA(void){ int i,j; for(i=0;i for(j=0;j if(xx[i][j]=='z')xx[i][j]='a'; else if(xx[i][j]>='a'&&xx[i][j]<='y')xx[i][j]+=1;} void main(){ clrscr();if(ReadDat()){ printf(“数据文件IN.DAT不能打开!n 07”); return;} ConvertCharA();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;char *p; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; clrscr(); fp=fopen(“OUT1.DAT”,“w”);for(i=0;i printf(“%sn”,xx[i]); fprintf(fp,“%sn”,xx[i]);} fclose(fp);} 题目11(无忧id 93题) 程序prog1.c的功能是:把 s 字符串中的所有字母改写成该字母的下一个字母,字母z改写成字母a。要求大写字母仍为大写字母,小写字母仍为小写字母,其它字符不做改变。 请考生编写函数chg(char *s)实现程序要求,最后调用函数readwriteDAT()把结果输出到文件bc1.out中。 例如:s 字符串中原有的内容为:Mn.123Zxy,则调用该函数后,结果为:No.123Ayz。 注意:部分源程序存在文件prog1.c文件中。 请勿改动主函数main()和输出数据函数readwriteDAT()的内容。#include void chg(char *s){while(*s)if(*s=='z'||*s=='Z'){*s-=25;s++;} else if(*s>='a'&&*s<='y'){*s+=1;s++;} else if(*s>='A'&&*s<='Y'){*s+=1;s++;} else s++;} main(){ char a[N]; clrscr(); printf(“Enter a string : ”);gets(a); printf(“The original string is : ”);puts(a); chg(a); printf(“The string after modified : ”); puts(a); readwriteDAT();} void readwriteDAT(){ int i; char a[N]; FILE *rf, *wf; rf = fopen(“bc1.in”, “r”); wf = fopen(“bc1.out”, “w”); for(i = 0;i < 50;i++){ fscanf(rf, “%s”, a); chg(a); fprintf(wf, “%sn”, a); } fclose(rf); fclose(wf);} ★题目12(无忧id 78题) 已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),数量sl(整型),金额je(长整型)五部分组成。其中:金额=单价*数量计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求: 按产品名称从小到大进行排列,若产品名称相等,则按金额从小到大进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT5.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include #define MAX 100 typedef struct{ char dm[5];/*产品代码*/ char mc[11];/*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ }PRO;PRO sell[MAX];void ReadDat();void WriteDat(); void SortDat(){int i,j;PRO xy;for(i=0;i<99;i++) for(j=i+1;j<100;j++) if(strcmp(sell[i].mc,sell[j].mc)>0||strcmp(sell[i].mc,sell[j].mc)==0&&sell[i].je>sell[j].je) {xy=sell[i];sell[i]=sell[j];sell[j]=xy;} } void main(){ memset(sell,0,sizeof(sell));ReadDat();SortDat();WriteDat();} void ReadDat(){ FILE *fp;char str[80],ch[11];int i; fp=fopen(“IN.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; sell[i].sl=atoi(ch); sell[i].je=(long)sell[i].dj*sell[i].sl; } fclose(fp);} void WriteDat(){ FILE *fp;int i; fp=fopen(“OUT5.DAT”,“w”);for(i=0;i<100;i++){ printf(“%s %s %4d %5d %5dn”,sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);fprintf(fp,“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);} fclose(fp);} 题目13(无忧id 81题(按金额从小到大进行排列)) 已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),数量sl(整型),金额je(长整型)五部分组成。其中:金额=单价*数量计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能 要求:按产品代码从小到大进行排列,若产品代码相等,则按金额从大到小进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT9.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include #define MAX 100 typedef struct{ char dm[5];/*产品代码*/ char mc[11];/*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ }PRO;PRO sell[MAX];void ReadDat();void WriteDat(); void SortDat(){int i,j;PRO xy;for(i=0;i<99;i++) for(j=i+1;j<100;j++) if(strcmp(sell[i].dm,sell[j].dm)>0||strcmp(sell[i].dm,sell[j].dm)==0&&sell[i].je {xy=sell[i];sell[i]=sell[j];sell[j]=xy;} } void main(){ memset(sell,0,sizeof(sell));ReadDat();SortDat();WriteDat();} void ReadDat(){ FILE *fp;char str[80],ch[11];int i; fp=fopen(“IN.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; sell[i].sl=atoi(ch); sell[i].je=(long)sell[i].dj*sell[i].sl; } fclose(fp);} void WriteDat(){ FILE *fp;int i; fp=fopen(“OUT9.DAT”,“w”);for(i=0;i<100;i++){ printf(“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);fprintf(fp,“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);} fclose(fp);} 题目14(无忧id 151题) 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:依次从数组a中取出一个四位数,如果该四位数连续大于该四位数以后的五个数且该数是奇数(该四位数以后不满五个数,则不统计),则统计出满足此条件的个数cnt并把这些四位数按从小到大的顺序存入数组b中,最后调用写函数writeDat()把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 注意:部分源程序存在文件prog1.c中。 程序中已定义数组:a[200],b[200],已定义变量:cnt 请勿改动数据文件IN.DAT中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。#include void jsVal(){int i,j,flag;for(i=0;i {for(j=i+1;j<=i+5;j++) if(a[i]>a[j]&&a[i]%2)flag=1; else {flag=0;break;} if(flag==1){b[cnt]=a[i];cnt++;} } for(i=0;i for(j=i+1;j if(b[i]>b[j]){flag=b[i];b[i]=b[j];b[j]=flag;} } void readDat(){ int i; FILE *fp; fp = fopen(“in.dat”, “r”); for(i = 0;i < MAX;i++)fscanf(fp, “%d”, &a[i]); fclose(fp);} void main(){ int i; readDat(); jsVal(); printf(“满足条件的数=%dn”, cnt); for(i = 0;i < cnt;i++)printf(“%d ”, b[i]); printf(“n”); writeDat();} writeDat(){ FILE *fp; int i; fp = fopen(“out.dat”, “w”); fprintf(fp, “%dn”, cnt); for(i = 0;i < cnt;i++)fprintf(fp, “%dn”, b[i]); fclose(fp);} 题目15(无忧id 150 题) 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:若一个四位数的千位数字上的值小于等于百位数字上的值,百位数字上的值小于等于十位数字上的值,以及十位数字上的值小于等于个位数字上的值,并且原四位数是偶数,则统计出满足此条件的个数cnt并把这些四位数按从小到大的顺序存入数组b中,最后调用写函数writeDat()把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 注意:部分源程序存在文件prog1.c中。 程序中已定义数组:a[200],b[200],已定义变量:cnt 请勿改动数据文件IN.DAT中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。#include void jsVal(){int i,j;int qw,bw,sw,gw;for(i=0;i {qw=a[i]/1000; bw=a[i]%1000/100; sw=a[i]%100/10;gw=a[i]%10; if((qw<=bw)&&(bw<=sw)&&(sw<=gw)&&(a[i]%2==0)) b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i]>b[j]){qw=b[i];b[i]=b[j];b[j]=qw;} } void readDat(){ int i; FILE *fp; fp = fopen(“in.dat”, “r”); for(i = 0;i < MAX;i++)fscanf(fp, “%d”, &a[i]); fclose(fp);} void main(){ int i; readDat(); jsVal(); printf(“满足条件的数=%dn”, cnt); for(i = 0;i < cnt;i++)printf(“%d ”, b[i]); printf(“n”); writeDat();} writeDat(){ FILE *fp; int i; fp = fopen(“out.dat”, “w”); fprintf(fp, “%dn”, cnt); for(i = 0;i < cnt;i++)fprintf(fp, “%dn”, b[i]); fclose(fp);} ★题目16(无忧id 23 题) 函数ReadDat()实现从文件IN.DAT中读取一篇英文文章存入到字符串数组xx中,请编制函数StrCharJR(),其函数的功能是:以行为单位把字符串中所有字符的ASCII值右移4位,然后把右移后的字符ASCII值再加上原字符的ASCII值,得到新的字符仍存入原字符串对应的位置上。最后把已处理的字符串仍按行重新存入字符串数组xx中,最后调用函数writeDat()把结果xx输出到文件OUT8.DAT中。 原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数writeDat()的内容。#include char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void StrCharJR(){int i,j;for(i=0;i for(j=0;j xx[i][j]+=(xx[i][j]>>4);} void main(){ clrscr();if(ReadDat()){ printf(“数据文件IN.DAT不能打开!n 07”); return;} StrCharJR();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;char *p; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i;clrscr();fp=fopen(“OUT8.DAT”,“w”);for(i=0;i printf(“%sn”,xx[i]); fprintf(fp,“%sn”,xx[i]);} fclose(fp);} 题目17 函数READDAT()实现从文件IN.DAT中读取一篇英文文章存入到字符串数组XX中;请编制函数ChA(),其函数功能是:以行为单位把字符串中的第一个字符的ASCII值加第二个字符的ASCII值,得到第一个亲朋字符,第二个字符的ASCII值加第三个字符的ASCII值,得到第二个新字符,依此类推一直处理到最后第二个字符,最后一个字符的ASCII值加原第一个字符的ASCII值,得到最后一个新的字符,得到的新字符分别存放在原字符串对应的位置上。最后把已处理的字符串逆转后按行重新存入字符串数组XX中,最后调用函数WRITEDAT()把结果XX输出到文件OUT9.DAT中.原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格.注意:部分源程序已给出。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数writeDat()的内容。 #include char xx[50][80];int maxline = 0;/* 文章的总行数 */ int ReadDat(void);void WriteDat(void); void ChA(void){ int i,j; char ch; for(i=0;i { ch=xx[i][0]; for(j=0;j xx[i][j]+=xx[i][j+1]; xx[i][strlen(xx[i])-1]+=ch; strrev(xx[i]); } } void main(){ clrscr();if(ReadDat()){ printf(“数据文件IN.DAT不能打开!n 07”); return;} ChA();WriteDat();} int ReadDat(void){ FILE *fp;int i = 0;char *p; if((fp = fopen(“IN.DAT”, “r”))== NULL)return 1;while(fgets(xx[i], 80, fp)!= NULL){ p = strchr(xx[i], 'n'); if(p)*p = 0; i++;} maxline = i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; clrscr();fp = fopen(“OUT9.DAT”, “w”);for(i = 0;i < maxline;i++){ printf(“%sn”, xx[i]); fprintf(fp, “%sn”, xx[i]);} fclose(fp);} 题目18(无忧id 1 题) 函数ReadDat()实现从文件ENG.IN中读取一篇英文文章,存入到字符串数组xx中;请编制函数encryptChar(),按给定的替代关系对数组xx中的所有字符进行替代,仍存入数组xx的对应的位置上,最后调用函数WriteDat()把结果xx输出到文件PS10.DAT中。 替代关系:f(p)=p*11 mod 256(p是数组中某一个字符的ASCII值,f(p)是计算后新字符的ASCII值),如果原字符的ASCII值是偶数或计算后f(p)值小于等于32,则该字符不变,否则将f(p)所对应的字符进行替代。 部分源程序存在文件prog1.c中。原始数据文件存放的格式是:每行的宽度均小于80个字符。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include unsigned char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void encryptChar(){ int i,j; for(i=0;i for(j=0;j if(xx[i][j]*11%256<=32||xx[i][j]%2==0)continue; else xx[i][j]=xx[i][j]*11%256;} void main(){ clrscr();if(ReadDat()){ printf(“数据文件ENG.IN不能打开!n 07”); return;} encryptChar();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;unsigned char *p; if((fp=fopen(“eng.in”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i;fp=fopen(“ps10.dat”,“w”);for(i=0;i 编写一个函数findStr(char *str,char *substr),该函数统计一个长度为2的子字符串在另一个字符串中出现的次数。例如,假定输入的字符串为“asd asasdfg asd as zx67 asd mklo”,子字符串为“as”,函数返回值是6。 函数ReadWrite()实现从文件in.dat中读取两个字符串,并调用函数findStr(),最后把结果输出到文件out.dat中。 注意:部分源程序存在文件prog1.c中。 请勿改动主函数main()和其它函数中的任何内容,仅在函数findStr()的花括号中填入你编写的若干语句。#include int findStr(char *str,char *substr){ int n=0; char *p , *r; while(*str) {p=str; r=substr; while(*r) if(*r==*p){ r++;p++;} else break; if(*r==' ') n++; str++; } return n;} main(){ char str[81], substr[3]; int n; clrscr(); printf(“输入原字符串:”); gets(str); printf(“输入子字符串:”); gets(substr); puts(str); puts(substr); n=findStr(str, substr); printf(“n=%dn”, n); ReadWrite();} ReadWrite(){ char str[81], substr[3], ch; int n, len, i = 0; FILE *rf, *wf; rf = fopen(“in.dat”, “r”); wf = fopen(“out.dat”, “w”); while(i < 25){ fgets(str, 80, rf); fgets(substr, 10, rf); len = strlen(substr)-1; ch = substr[len]; if(ch == 'n' || ch == 0x1a)substr[len] = 0; n=findStr(str, substr); fprintf(wf, “%dn”, n); i++; } fclose(rf); fclose(wf);} 解法二: int findStr(char *str,char *substr){ int i,j,len1,len2,cnt=0,flag; len1=strlen(str); len2=strlen(substr); for(i=0;i { for(j=0;j if(str[i+j]==substr[j]) flag=1; else {flag=0;break;} if(flag==1)cnt++; } return cnt;} 解法三: int findStr(char *str,char *substr){ int i,cnt=0;for(i=0;i if(str[i]==*substr&&str[i+1]==*(substr+1))cnt++; return cnt;} 解法四: int findStr(char *str,char *substr){int cnt=0;while(*str) if(*str==*substr&&*(str+1)==*(substr+1)){ cnt++;str++;} else str++;return cnt;} 题目20(无忧id 80 题) 编写函数jsValue,它的功能是:求Fibonacci数列中大于t的最小的一个数,结果由函数返回。其中Fibonacci数列F(n)的定义为: F(0)=0,F(1)=1 F(n)=F(n-1)+F(n-2) 最后调用函数writeDat()读取50个数据t,分别得出结果且把结果输出到文件out.dat中。 例如:当t=1000时,函数值为:1597。 部分源程序存在文件prog1.c中。 请勿改动主函数main()和写函数writeDat()的内容。#include int jsValue(int t){ int f0=0,f1=1,fn; fn=f0+f1; while(fn<=t) { f0=f1; f1=fn; fn=f0+f1; } return fn;} main(){ int n;n=1000;printf(“n=%d,f=%dn”,n,jsValue(n));writeDat();} writeDat(){ FILE *in,*out;int i,n,s; in=fopen(“in.dat”,“r”);out=fopen(“out.dat”,“w”);for(i=0;i<50;i++){ fscanf(in,“%d”,&n); s=jsValue(n); printf(“%dn”,s); fprintf(out,“%dn”,s);} fclose(in);fclose(out);} 题目21(无忧id 53 迭代方法求方程题) 下列程序prog1.c的功能是:利用以下所示的简单迭代方法求方程:cos(x)-x=0的一个实根。 Xn+1=cos(Xn) 迭代步骤如下:(1)取X1初值为0.0; (2)X0=X1,把X1的值赋给X0;(3)X1=cos(X0),求出一个新的X1; (4)若X0-X1的绝对值小于0.000001,执行步骤(5),否则执行步骤(2);(5)所求X1就是方程cos(X)-X=0的一个实根,作为函数值返回。 请编写函数countValue()实现程序的要求,最后调用函数writeDat()把结果输出到文件OUT17.DAT中。 部分源程序已给出。 请勿改动主函数main()和输出数据函数writeDat()的内容。#include float countValue(){ double x0,x1; x1=0.0; do{ x0=x1; x1=cos(x0); }while(fabs(x0-x1)>=0.000001); return x1;} main(){ clrscr();printf(“实根=%fn”,countValue());printf(“%fn”,cos(countValue())-countValue());writeDat();} writeDat(){ FILE *wf; wf=fopen(“OUT17.DAT”,“w”);fprintf(wf,“%fn”,countValue());fclose(wf);} ★题目22(无忧id 39平方根问题) 请编写函数countValue(),它的功能是:求n以内(不包括n)同时能被3与7整除的所有自然数之和的平方根s,并作为函数值返回,最后结果s输出到文件out.dat中。 例如若n为1000时,函数值应为:s=153.909064。 部分源程序存在文件prog1.c中。 请勿改动主函数main()和输入输出数据函数progReadWrite()的内容。#include double countValue(int n){ int i; double s=0.0; for(i=1;i if(i%21==0)s+=i; return sqrt(s);} main(){ clrscr();printf(“自然数之和的平方根=%fn”,countValue(1000));progReadWrite();} progReadWrite(){ FILE *fp,*wf;int i,n;float s; fp=fopen(“in.dat”,“r”);if(fp==NULL){ printf(“数据文件in.dat不存在!”); return;} wf=fopen(“out.dat”,“w”);for(i=0;i<10;i++){ fscanf(fp,“%dn”,&n); s=countValue(n); fprintf(wf,“%fn”,s);} fclose(fp);fclose(wf);} ★题目23(实数运算题) 已知在文件in.dat中存有N个(个数<200)实数,函数readdat()读取这N个实数并存入数组xx中。请编制函数calvalue(),其功能要求: 1、求出这N个实数的平均值aver; 2、分别求出这N个实数的整数部分之和sumint以及小数部分之和sumdec,最后调用函数writedat()把所求的结果输出到文件out.dat中。 注意:部分源程序已给出。 请勿改动主函数main()、读数据函数readdat()和输出数据函数writedat()的内容。#include float xx[MAXNUM];int N= 0;/* 文件IN.DAT中共有多少个实数 */ double aver=0.0;/*平均值*/ double sumint=0.0;/*整数部分之和*/ double sumdec=0.0;/*小数部分之和*/ int ReadDat(void);void WriteDat(void); void CalValue(void){int i;for(i=0;i sumdec+=xx[i]-(long)xx[i]; aver+=xx[i]; } aver/=N;} void main(){ int i;clrscr();for(i = 0;i < MAXNUM;i++)xx[i] = 0;if(ReadDat()){ printf(“数据文件IN.DAT不能打开! 07n”); return;} Calvalue();printf(“文件IN.DAT中共有实数=%d个n”, N);printf(“平均值=%.2lfn”, aver);printf(“整数部分之和=%.2lfn”, sumint);printf(“小数部分之和=%.2lfn”, sumdec);WriteDat();system(“pause”);} int ReadDat(void){ FILE *fp;int i = 0; if((fp = fopen(“in.dat”, “r”))== NULL)return 1;while(!feof(fp)){ fscanf(fp, “%d,”, &xx[i++]);} fclose(fp);return 0;} void WriteDat(void){ FILE *fp; fp = fopen(“OUT.DAT”, “w”);fprintf(fp, “%.2lfn%.2lfn%.2lfn”, aver,sumint,sumdec);fclose(fp);} ☆题目24(无忧id 16 完全平方数问题) 下列程序prog1.c的功能是:在三位整数(100至999)中寻找符合条件的整数并依次从小到大存入数组中;它既是完全平方数,又是两位数字相同,例如144、676等。 请编制函数实现此功能,满足该条件的整数的个数通过所编制的函数返回。 最后调用函数writeDat()把结果输出到文件out.dat中。 请勿改动主函数main()和写函数writeDat()的内容。#include int jsValue(int bb[]){int i,j,k=0;int hun,ten,data;for(i=100;i<=999;i++) {j=10; while(j*j<=i) {if(i==j*j) { hun=i/100;data=i%100/10;ten=i%10; if(hun==ten||hun==data||ten==data)bb[k++]=i; } j++; } } return k;} main(){ int b[20],num;num=jsValue(b);writeDat(num,b);} writeDat(int num,int b[]){ FILE *out;int i; out=fopen(“out.dat”,“w”);printf(“%dn”,num);fprintf(out,“%dn”,num);for(i=0;i 另一解法: int jsValue(int bb[]){int i,j,cnt=0,bw,sw,gw;for(i=100;i<=999;i++) { bw=i/100;sw=i%100/10;gw=i%10; for(j=10;j*j<=i;j++) if(i==j*j&&(bw==sw||sw==gw||gw==bw))bb[cnt++]=i; } return cnt;} ★☆题目25(回文数问题) 下列程序的功能是:寻找并输出11至999之间的数m,它满足m,m2和m3均为回文数。所谓回文数是指其各位数字左右对称的整数,例如121,676,94249等。满足上述条件的数如m=11,m2=121,m3=1331皆为回文数。请编制函数int svalue(long m)实现此功能,如果是回文数,则函数返回1,反之则返回0。最后把结果输出到文件out.dat中。 注意:部分源程序已给出。 请勿改动主函数main()的内容。 #include int jsValue(long n){int i,strl,half;char xy[20];ltoa(n,xy,10);/*注意这里不能使用itoa()函数,因为n是long 型的*/ strl=strlen(xy);half=strl/2;for(i=0;i if(xy[i]!=xy[--strl])break; if(i>=half)return 1; else return 0;} main(){long m;FILE *out;out=fopen(“out.dat”,“w”);for(m=11;m<1000;m++) { if(jsValue(m)&&jsValue(m*m)&&jsValue(m*m*m)) { printf(“m=%4ld,m*m=%6ld,m*m*m=%8ld n”,m,m*m,m*m*m); fprintf(out,“m=%4ld,m*m=%6ld,m*m*m=%8ld n”,m,m*m,m*m*m); } } fclose(out);system(“pause”);} 或者下面的解法: int jsValue(long n){long int s=0,k;k=n;while(k) { s=s*10+k%10; k/=10; } if(s==n)return 1;if(s!=n)return 0;} 输出结果为: m= 11,m*m= 121,m*m*m= 1331 m= 101,m*m= 10201,m*m*m= 1030301 m= 111,m*m= 12321,m*m*m= 1367631 ★题目26(无忧id 37 整数统计运算题) 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整数,函数ReadDat()读取这若干个正整数并存入数组xx中。请编制函数CalValue(),其功能要求: 1、求出这文件中共有多少个正整数totNum; 2、求这些数右移1位后,产生的新数是偶数的数的个数totCnt,以及满足此条件的这些数(右移前的值)的算术平均值totPjz,最后调用函数writeDat()把所求的结果输出到文件OUT.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读函数ReadDat()和写函数writeDat()的内容。#include int xx[MAXNUM];int totNum=0;/*文件IN.DAT中共有多少个正整数*/ int totCnt=0;/*符合条件的正整数的个数*/ double totPjz=0.0; /*平均值*/ int ReadDat(void);void writeDat(void); void CalValue(void){int i,data;for(i=0;i if(xx[i]>0) { totNum++; data=xx[i]>>1; if(data%2==0){totCnt++;totPjz+=xx[i];} } if(totCnt==0)totPjz=0;else totPjz/=totCnt;} void main(){ int i;clrscr();for(i=0;i printf(“数据文件IN.DAT不能打开! 07n”); return;} CalValue();printf(“文件IN.DAT中共有正整数=%d个n”,totNum);printf(“符合条件的正整数的个数=%d个n”,totCnt);printf(“平均值=%.2fn”,totPjz);writeDat();} int ReadDat(void){ FILE *fp;int i=0; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;while(!feof(fp)){ fscanf(fp,“%d,”,&xx[i++]); } fclose(fp);return 0;} void writeDat(void){ FILE *fp;fp=fopen(“OUT.DAT”,“w”); fprintf(fp,“%dn%dn%6.2fn”,totNum,totCnt,totPjz);fclose(fp);} ★题目27(无忧id 57 整数各位数字运算题) 已知数据文件in.dat中存有300个四位数,并已调用读函数ReadDat()把这些数存入数组a中,请编制一函数jsValue(),其功能是:求出千位数上的数减百位数上的数减十位数上的数减个位数上的数大于零的个数cnt,再把所有满足此条件的四位数依次存入数组b中,然后对数组b的四位数按从小到大的顺序进行排序,最后调用写函数writeDat()把结果输出到out.dat文件。 例如:9123,9-1-2-3>0,则该数满足条件存入数组b中,且个数cnt=cnt+1。 9812,9-8-1-2>0,则该数不满足条件忽略。 部分源程序存在文件prog1.c中。 程序中已定义数组:a[300],b[300],已定义变量:cnt 请勿改动主函数main()、读函数ReadDat()和写函数writeDat()的内容。#include jsValue(){ int i,j,qw,bw,sw,gw; for(i=0;i<300;i++) { qw=a[i]/1000; bw=a[i]/100%10; sw=a[i]%100/10;gw=a[i]%10; if(qw-bw-sw-gw>0)b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i]>b[j]){ qw=b[i];b[i]=b[j];b[j]=qw;} } main(){ int i; readDat();jsValue();writeDat();printf(“cnt=%dn”,cnt);for(i=0;i readDat(){ FILE *fp;int i;fp=fopen(“in.dat”,“r”); for(i=0;i<300;i++)fscanf(fp,“%d,”,&a[i]);fclose(fp);} writeDat(){ FILE *fp;int i;fp=fopen(“out.dat”,“w”);fprintf(fp,“%dn”,cnt);for(i=0;i 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:把千位数字和十位数字重新组成一个新的十位数ab(新十位数的十位数字是原四位数的千位数字,新十位数的个位数字是原四位数的十位数字),以及把个位数字和百位数字组成另一个新的十位数cd(新十位数的十位数字是原四位数的个位数字,新十位数的个位数字是原四位数的百位数字),如果新组成的两个十位数ab-cd>=0且ab-cd<=10且两个数均是奇数,同时两个新数的十位数字均不为零,则将满足此条件的四位数按从大到小的顺序存入数组b中,并要计算满足上述条件的四位数的个数cnt。最后main()函数调用写函数writeDat()把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 注意:部分源程序存在文件prog1.c中。 程序中已定义数组:a[200],b[200],已定义变量:cnt 请勿改动数据文件IN.DAT中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。#include void jsVal(){int i,j,thou,hun,ten,data,ab,cd;for(i=0;i<200;i++) {thou=a[i]/1000;hun=a[i]%1000/100; ten=a[i]%100/10;data=a[i]%10; ab=10*thou+ten;cd=10*data+hun; if((ab-cd)>=0&&(ab-cd)<=10&&ab%2==1&&cd%2==1&&ab>=10&&cd>=10) b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i] void readDat(){ int i; FILE *fp; fp = fopen(“in.dat”, “r”); for(i = 0;i < MAX;i++)fscanf(fp, “%d”, &a[i]); fclose(fp);} void main(){ int i; readDat(); jsVal(); printf(“满足条件的数=%dn”, cnt); for(i = 0;i < cnt;i++)printf(“%d ”, b[i]); printf(“n”); writeDat();} writeDat(){ FILE *fp; int i; fp = fopen(“out.dat”, “w”); fprintf(fp, “%dn”, cnt); for(i = 0;i < cnt;i++)fprintf(fp, “%dn”, b[i]); fclose(fp);} ★题目29(无忧id 139整数各位打散组合运算题) 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:把千位数字和十位数字重新组成一个新的十位数ab(新十位数的十位数字是原四位数的千位数字,新十位数的个位数字是原四位数的十位数字),以及把个位数字和百位数字组成另一个新的十位数cd(新十位数的十位数字是原四位数的个位数字,新十位数的个位数字是原四位数的百位数字),如果新组成的两个十位数ab-cd>=10且ab-cd<=20且两个数均是偶数,同时两个新数的十位数字均不为零,则将满足此条件的四位数按从大到小的顺序存入数组b中,并要计算满足上述条件的四位数的个数cnt。 最后main()函数调用写函数writeDat()把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 注意:部分源程序存在文件prog1.c中。 程序中已定义数组:a[200],b[200],已定义变量:cnt 请勿改动数据文件IN.DAT中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。#include void jsVal(){ int i,j,qw,bw,sw,gw,ab,cd;for(i=0;i { qw=a[i]/1000; bw=a[i]/100%10; sw=a[i]%100/10;gw=a[i]%10; ab=qw*10+sw; cd=gw*10+bw; if(ab-cd>=10&&ab-cd<=20&&ab%2==0&&cd%2==0&&qw!=0&&gw!=0) b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i] void readDat(){ int i; FILE *fp; fp = fopen(“in.dat”, “r”); for(i = 0;i < MAX;i++)fscanf(fp, “%d”, &a[i]); fclose(fp);} void main(){ int i; readDat(); jsVal(); printf(“满足条件的数=%dn”, cnt); for(i = 0;i < cnt;i++)printf(“%d ”, b[i]); printf(“n”); writeDat();} writeDat(){ FILE *fp; int i; fp = fopen(“out.dat”, “w”); fprintf(fp, “%dn”, cnt); for(i = 0;i < cnt;i++)fprintf(fp, “%dn”, b[i]); fclose(fp);} 题目30(无忧id 152 整数统计排序题) 已知数据文件IN.DAT中存有200个四位数,并已调用读函数readDat()把这些数存入数组a中,请考生编制一函数jsVal(),其功能是:依次从数组a中取出一个四位数,如果该四位数连续小于该四位数以后的五个数且该数是偶数(该四位数以后不满五个数,则不统计),则统计出满足此条件的个数cnt并把这些四位数按从小到大的顺序存入数组b中,最后调用写函数writeDat()把结果cnt以及数组b中符合条件的四位数输出到OUT.DAT文件中。 注意:部分源程序存在文件prog1.c中。 程序中已定义数组:a[200],b[200],已定义变量:cnt 请勿改动数据文件IN.DAT中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。#include void jsVal(){int i,j,flag;for(i=0;i {for(j=i+1;j<=i+5;j++) if(a[i] else { flag=0;break;} if(flag==1)b[cnt++]=a[i]; } for(i=0;i for(j=i+1;j if(b[i]>b[j]){flag=b[i];b[i]=b[j];b[j]=flag;} } void readDat(){ int i; FILE *fp; fp = fopen(“in.dat”, “r”); for(i = 0;i < MAX;i++)fscanf(fp, “%d”, &a[i]); fclose(fp);} void main(){ int i; readDat(); jsVal(); printf(“满足条件的数=%dn”, cnt); for(i = 0;i < cnt;i++)printf(“%d ”, b[i]); printf(“n”); writeDat();} writeDat(){ FILE *fp; int i; fp = fopen(“out.dat”, “w”); fprintf(fp, “%dn”, cnt); for(i = 0;i < cnt;i++)fprintf(fp, “%dn”, b[i]); fclose(fp);} ★题目31(无忧id 17 结构体运算题) 已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),数量sl(整型),金额je(长整型)五部分组成。其中:金额=单价*数量计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按金额从大到小进行排列,若金额相同,则按产品代码从大到小进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT4.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include #define MAX 100 typedef struct{ char dm[5];/*产品代码*/ char mc[11];/*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ }PRO;PRO sell[MAX];void ReadDat();void WriteDat(); void SortDat(){int i,j;PRO xy;for(i=0;i<99;i++) for(j=i+1;j<100;j++) if(sell[i].je {xy=sell[i];sell[i]=sell[j];sell[j]=xy;} } void main(){ memset(sell,0,sizeof(sell));ReadDat();SortDat();WriteDat();} void ReadDat(){ FILE *fp;char str[80],ch[11];int i; fp=fopen(“IN.DAT”,“r”);for(i=0;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; sell[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(“OUT4.DAT”,“w”);for(i=0;i printf(“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);fprintf(fp,“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);} fclose(fp);} ☆题目32(无忧id 79 结构体运算题) 已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),数量sl(整型),金额je(长整型)五部分组成。其中:金额=单价*数量计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品名称从大到小进行排列,若产品名称相等,则按金额从小到大进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT7.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include #define MAX 100 typedef struct{ char dm[5];/*产品代码*/ char mc[11];/*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ }PRO;PRO sell[MAX];void ReadDat();void WriteDat(); void SortDat(){int i,j;PRO xy;for(i=0;i<99;i++) for(j=i+1;j<100;j++) if(strcmp(sell[i].mc,sell[j].mc)<0||strcmp(sell[i].mc,sell[j].mc)==0&&sell[i].je>sell[j].je) {xy=sell[i];sell[i]=sell[j];sell[j]=xy;} } void main(){ memset(sell,0,sizeof(sell));ReadDat();SortDat();WriteDat();} void ReadDat(){ FILE *fp;char str[80],ch[11];int i; fp=fopen(“IN.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; sell[i].sl=atoi(ch); sell[i].je=(long)sell[i].dj*sell[i].sl; } fclose(fp);} void WriteDat(){ FILE *fp;int i; fp=fopen(“OUT7.DAT”,“w”);for(i=0;i<100;i++){ printf(“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);fprintf(fp,“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);} fclose(fp);} ★题目33(无忧id 61 方差运算题) 请编制函数ReadDat()实现从文件IN.DAT中读取1000个十进制整数到数组xx中;请编制函数Compute()分别计算出xx中偶数的个数even,奇数的平均值ave1,偶数的平均值ave2以及方差totfc的值,最后调用函数WriteDat()把结果输出到OUT.DAT文件中。 计算方差的公式如下: N totfc=1/N∑(xx[i]-ave2) i=1 设N为偶数的个数,xx[i]为偶数,ave2为偶数的平均值。 原始数据文件存放的格式是:每行存放10个数,并用逗号隔开。(每个数均大于0且小于等于2000) 部分源程序存在文件prog1.c中。 请勿改动主函数main()和输出数据函数writeDat()的内容。#include int xx[MAX],odd=0,even=0;double ave1=0.0,ave2=0.0,totfc=0.0;void WriteDat(void); int ReadDat(void){int i;FILE *fp; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;/*********编制函数ReadDat()的部分************/ for(i=0;i if((i+1)%10==0) fscanf(fp,“n”);} /*******************************************/ fclose(fp);return 0;} void Compute(void){ int i,yy[MAX]; for(i=0;i yy[i]=0; for(i=0;i if(xx[i]%2==0){ yy[even++]=xx[i];ave2+=xx[i];} else { odd++; ave1+=xx[i];} if(odd==0)ave1=0; else ave1/=odd; if(even==0)ave2=0; else ave2/=even; for(i=0;i totfc+=(yy[i]-ave2)*(yy[i]-ave2)/even;} void main(){ int i; for(i=0;i printf(“数据文件IN.DAT不能打开! 07n”); return;} Compute();printf(“OVEN=%dnAVE1=%fnAVER2=%fnTOTFC=%fn”,even,ave1,ave2,totfc);WriteDat();} void WriteDat(void){ FILE *fp;int i; fp=fopen(“OUT.DAT”,“w”);fprintf(fp,“%dn%fn%fn%fn”,even,ave1,ave2,totfc);fclose(fp);} ★☆题目34(无忧id 73,102 素数题)无忧id 102 题提供了求素数isPrime()函数 程序prog1.c的功能是:选出100以上1000之内所有个位数字与十位数字之和被10除所得余数恰是百位数字的素数(如293)。计算并输出上述这些素数的个数cnt以及这些素数值的和sum。请考生编写函数countValue()实现程序要求,最后调用函数writeDAT()把结果cnt和sum输出到文件bc10.out中。 注意:部分源程序存放在文件prog1.c中。 请勿改动主函数main()和输出数据函数writeDAT()的内容。#include void countValue(){ int i,j,bw,sw,gw; for(i=100;i<1000;i++) { bw=i/100;sw=i%100/10;gw=i%10; for(j=2;j if(i%j==0)break; if((i==j)&&(gw+sw)%10==bw){ cnt++;sum+=i;} } } void main(){ cnt=sum=0; countValue(); printf(“素数的个数=%dn”, cnt); printf(“满足条件素数值的和=%d”, sum); writeDAT();} writeDAT(){ FILE *fp; fp = fopen(“bc10.out”, “w”); fprintf(fp, “%dn%dn”, cnt, sum); fclose(fp);} ★☆题目35(无忧id 20 级数运算题) 某级数的前两项A1=1,A2=1,以后各项具有如下关系: An=An-2+2An-1(注:n-2与n-1为下标) 下列程序prog1.c的功能是:要求依次对于整数M=100,1000和10000求出对应的n值,使其满足:Sn 请勿改动主函数main()和写函数writeDat()的内容。#include jsValue(){int a1=1,a2=1,a12,sn,k=2;sn=a1+a2;while(1) {a12=a1+2*a2; if(sn<100&&sn+a12>=100)b[0]=k; if(sn<1000&&sn+a12>=1000)b[1]=k; if(sn<10000&&sn+a12>=10000){b[2]=k;break;} sn=sn+a12; a1=a2;a2=a12; k++; } } main(){ jsValue();printf(“M=100,n=%dnM=1000,n=%dnM=10000,n=%dn”,b[0],b[1],b[2]);writeDat();} writeDat(){ FILE *fp; fp=fopen(“out.dat”,“w”); printf(“%dn%dn%dn”,b[0],b[1],b[2]); fprintf(fp,“%dn%dn%dn”,b[0],b[1],b[2]); fclose(fp);} ★☆题目36(无忧id 5 字符替换题) 函数ReadDat()实现从文件ENG.IN中读取一篇英文文章,存入到字符串数组xx中;请编制函数encryptChar(),按给定的替代关系对数组xx中的所有字符进行替代,仍存入数组xx的对应的位置上,最后调用函数WriteDat()把结果xx输出到文件pS6.DAT中。 替代关系:f(p)=p*11 mod 256(p是数组中某一个字符的ASCII值,f(p)是计算后新字符的ASCII值),如果计算后f(p)值小于等于32或f(p)对应的字符是数字0至9,则该字符不变,否则将f(p)所对应的字符进行替代。 部分源程序存在文件prog1.c中。原始数据文件存放的格式是:每行的宽度均小于80个字符。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include unsigned char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void encryptChar(){ int i,j; for(i=0;i for(j=0;j if(xx[i][j]*11%256<=32||xx[i][j]*11%256>='0'&&xx[i][j]*11%256<='9')continue; else xx[i][j]=xx[i][j]*11%256;} void main(){ clrscr();if(ReadDat()){ printf(“数据文件ENG.IN不能打开!n 07”); return;} encryptChar();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;unsigned char *p; if((fp=fopen(“eng.in”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; fp=fopen(“ps6.dat”,“w”);for(i=0;i 函数ReadDat()实现从文件ENG.IN中读取一篇英文文章,存入到字符串数组xx中;请编制函数encryptChar(),按给定的替代关系对数组xx中的所有字符进行替代,仍存入数组xx的对应的位置上,最后调用函数WriteDat()把结果xx输出到文件PS7.DAT中。 替代关系:f(p)=p*11 mod 256(p是数组中某一个字符的ASCII值,f(p)是计算后新字符的ASCII值),如果原字符是大写字母或计算后f(p)值小于等于32,则该字符不变,否则将f(p)所对应的字符进行替代。 部分源程序存在文件prog1.c中。原始数据文件存放的格式是:每行的宽度均小于80个字符。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include unsigned char xx[50][80];int maxline=0;/*文章的总行数*/ int ReadDat(void);void WriteDat(void); void encryptChar(){ int i,j; for(i=0;i for(j=0;j if(xx[i][j]*11%256<=32||xx[i][j]>='A'&&xx[i][j]<='Z')continue; else xx[i][j]=xx[i][j]*11%256;} void main(){ clrscr();if(ReadDat()){ printf(“数据文件ENG.IN不能打开!n 07”); return;} encryptChar();WriteDat();} int ReadDat(void){ FILE *fp;int i=0;unsigned char *p; if((fp=fopen(“eng.in”,“r”))==NULL)return 1;while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],'n'); if(p)*p=0; i++;} maxline=i;fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i; fp=fopen(“ps7.dat”,“w”);for(i=0;i printf(“%sn”,xx[i]); fprintf(fp,“%sn”,xx[i]);} fclose(fp);} ★题目38(无忧id 81 结构体运算题) 已知在文件IN.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位),产品名称mc(字符型10位),单价dj(整型),数量sl(整型),金额je(长整型)五部分组成。其中:金额=单价*数量计算得出。函数ReadDat()是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品代码从小到大进行排列,若产品代码相同,则按金额从小到大进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT6.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数WriteDat()的内容。#include #define MAX 100 typedef struct{ char dm[5];/*产品代码*/ char mc[11];/*产品名称*/ int dj; /*单价*/ int sl; /*数量*/ long je; /*金额*/ }PRO;PRO sell[MAX];void ReadDat();void WriteDat(); void SortDat(){int i,j;PRO xy;for(i=0;i<99;i++) for(j=i+1;j<100;j++) if(strcmp(sell[i].dm,sell[j].dm)>0||strcmp(sell[i].dm,sell[j].dm)==0&&sell[i].je>sell[j].je) {xy=sell[i];sell[i]=sell[j];sell[j]=xy;} } void main(){ memset(sell,0,sizeof(sell));ReadDat();SortDat();WriteDat();} void ReadDat(){ FILE *fp;char str[80],ch[11];int i; fp=fopen(“IN.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; sell[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(“OUT6.DAT”,“w”);for(i=0;i<100;i++){ printf(“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);fprintf(fp,“%s %s %4d %5d %5dn”, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);} fclose(fp);} ★☆题目39(无忧id 63 选票问题) 现有一个10个人100行的选票数据文件IN.DAT,其数据存放的格式是每条记录的长度均为10位,第一位表示第一个人的选中情况,第二位表示第二个人的选中情况,依此类推 :内容均为字符0和1,1表示此人被选中,0表示此人未被选中,全选或不选均为无效的选票。给定函数ReadDat()的功能是把选票数据读入到字符串数组xx中。请编制函数CountRs()来统计每个人的选票数并把得票数依次存入yy[0]到yy[9]中。把结果yy输出到文件OUT.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读数据函数ReadDat()和输出数据函数writeDat()的内容。#include char xx[100][11];int yy[10];int ReadDat(void);void WriteDat(void); void CountRs(void){ int i,j,count; for(i=0;i<100;i++) { count=0; for(j=0;j<10;j++) if(xx[i][j]=='1')count++; if(count==0||count==10)continue; for(j=0;j<10;j++) if(xx[i][j]=='1')yy[j]++; } } void main(){ int i; for(i=0;i<10;i++)yy[i]=0; if(ReadDat()){ printf(“选票数据文件IN.DAT不能打开!n 07”); return;} CountRs();WriteDat();} int ReadDat(void){ FILE *fp;int i; if((fp=fopen(“IN.DAT”,“r”))== NULL)return 1;for(i=0;i<100;i++){ if(fgets(xx[i],11,fp)==NULL)return 1; xx[i][10]=' '; } fclose(fp);return 0;} void WriteDat(void){ FILE *fp;int i;fp=fopen(“OUT.DAT”,“w”);for(i=0;i<10;i++){ fprintf(fp,“%dn”,yy[i]); printf(“第%d个人的选票数=%dn”,i+1,yy[i]);} fclose(fp);} ★题目40(无忧id 43 整数统计运算题) 已知在文件IN.DAT中存有若干个(个数<200)四位数字的正整数,函数ReadDat()读取这若干个正整数并存入数组xx中。请编制函数CalValue(),其功能要求: 1、求出这文件中共有多少个正整数totNum; 2、求这些数中的各位数字之和是偶数的数的个数totCnt,以及满足此条件的这些数的算术平均值totPjz,最后调用函数writeDat()把所求的结果输出到文件OUT.DAT中。 部分源程序存在文件prog1.c中。 请勿改动主函数main()、读函数ReadDat()和写函数writeDat()的内容。#include int xx[MAXNUM];int totNum=0;/*文件IN.DAT中共有多少个正整数*/ int totCnt=0;/*符合条件的正整数的个数*/ double totPjz=0.0; /*平均值*/ int ReadDat(void);void writeDat(void); void CalValue(void){ int i,qw,bw,sw,gw; for(i=0;i qw=xx[i]/1000; bw=xx[i]/100%10; sw=xx[i]%100/10; gw=xx[i]%10; if((qw+bw+sw+gw)%2==0){ totCnt++;totPjz+=xx[i];} } if(totCnt==0)totPjz=0; else totPjz/=totCnt;} void main(){ int i;clrscr();for(i=0;i printf(“数据文件IN.DAT不能打开! 07n”); return;} CalValue();printf(“文件IN.DAT中共有正整数=%d个n”,totNum);printf(“符合条件的正整数的个数=%d个n”,totCnt);printf(“平均值=%.2fn”,totPjz);writeDat();} int ReadDat(void){ FILE *fp;int i=0; if((fp=fopen(“IN.DAT”,“r”))==NULL)return 1;while(!feof(fp)){ fscanf(fp,“%d,”,&xx[i++]); } fclose(fp);return 0;} void writeDat(void){ FILE *fp;fp=fopen(“OUT.DAT”,“w”); fprintf(fp,“%dn%dn%6.2fn”,totNum,totCnt,totPjz);fclose(fp);} ★☆题目41(无忧id 51 SIX/NINE问题) 下列程序prog1.c的功能是:计算出自然数SIX和NINE,它们满足的条件是SIX+SIX+SIX=NINE+NINE的个数cnt以及满足此条件所有的SIX与NINE的和SUM。请编写函数countValue()实现程序的要求,最后调用函数writeDat()把结果cnt和sum,输出到文件OUT15.DAT中。 其中的S,I,X,N,E各代表一个十进制数字。 部分源程序存在文件prog1.c中。 请勿改动主函数main()和输出数据函数writeDat()的内容。#include void countValue(){ int s,i,x,n,e,six,nine; for(s=1;s<10;s++) for(i=0;i<10;i++) for(x=0;x<10;x++) for(n=1;n<10;n++) for(e=0;e<10;e++) { six=s*100+i*10+x; nine=n*1000+i*100+n*10+e; if(3*six==2*nine) { cnt++;sum+=six+nine;} } } void main(){ cnt=sum=0; English Unit 2: 1)原文:I was shocked when she asked me this at that time.I always thought thus was a game between her and me.She saw the confusion on my face and told me, “This question is very important.It shows that you have really lived in our life.For every body part you gave me in the past, I have said that you were wrong and I have encouraged your quest further.But today is the day you need to learn this important lesson.” 翻译:我很吃惊,母亲在这个时候提出这个问题。我一直以为这是我和她之间的一个游戏。母亲看到我一脸迷茫,说道:“这是个非常重要的问题。它表明你一直在思考生活的意义。过去,每当你说出一个答案时,我都告诉你错了并鼓励你继续深入思考,但是,今天该是你学习这重要一课的时候了。” 2)句子原文: 1、That just means that most of the people you’re going to meet are in the same boat that you are in.翻译:这也意味着你将遇到的多数人都和你际遇相同。 2、You’ll be much eager to interact with other, even if you’re the shy type.翻译:你便会极为渴望与他们交往,即便你是一个非常害羞的人。 3、The very best way to meet new friends is to get involved.翻译:结交新朋友最好的方式就是参与其中。 4、Getting to know someone and building a new friendship takes time.翻译:因为了解一个人,建立新的友谊需要时间来培养。 Unit 4 1)原文:All this also shows me how easy it would be just to live somewhere else-anywhere else really.Staying in each place for an extended time taught me how I could make friend, find work, and find a flat all rather easily.So, in many ways, for all intents and purposes it’s as if I were living there already.翻译:所有这些还告诉我,生活在另一个地方——实际上随便什么地方也是一样的轻松愉快。只要在一个地方一段时间我就知道如何轻松地交到朋友,怎样不费力的找到工作和栖身之地。所以,在很多方面,无论怎么看,我好像本来就生活在这里。 2)句子原文: 1、the most difficult it will be to get there, the most interesting and different your experience will be.翻译:到那里的路越是艰辛你就越会体会到它的与众不同。 2、One thing you can always do is to find a world map or globe and choose a random point without looking at it.翻译:屡试不爽的办法就是找来一副世界地图或者一个地球仪,然后不假思索的随便指一个地方。 3、A totally unique way to travel and see new places is to go on a voluntary group camp.翻译:一种与众不同的把旅游和参观新景点结合起来的方法就是参加志愿者宿营。 4、This is usually not as original and unique as the other methods, but it can give you some nice destinations you have never seen before.翻译:虽然这不如其他方式新颖独特,但它还是会带你去曾去过的风景优美的地方。 Unit 5 1)原文:The financial burden is the obvious reason for this.Commonly, students take low skilled part-time work in the retail and service industry with the purpose of making some money.A research report carried out by a university found that of working students surveyed, 34% were sales assistant, 31% were in food service jobs and 5% in telesales.翻译:经济负担是做兼职的显而易见的原因所在。一般情况下,学生们为了挣点钱,会选择在零售业和服务业从事技术含量低的工作。某大学的一项调查报告发现,在所调查的兼职学生中,有34%的学生做过销售代表,31%从事过食品服务行业,还有5%从事过电话销售。 2)句子翻译: 1、More college student than ever are entering the workforce while still attending classes, usually only for part-time work.翻译:越来越多的大学生在校期间就参加到劳动大军里,通常是一边读 书一边兼职。 2、Part-time work for college students does have some unique restrictions.翻译:兼职对于大学生来说还是有些特殊的限制。 3、Hours are flexible and generally the student can work as much or as little as they want.翻译:一般来说,学生可以自己决定多干或者少干。 4、This type of job is a great way to get a foot in the door with industry leaders.翻译:这项工作非常有利于向结识企业家迈向第一步。 翻 8页 译题 1、他快速地瞥了她一眼。(glance)He glanced at her quickly.2、随道云层的到来,天色很快暗了下来。(darken)As clouds were coming,it darkened quickly.3、我觉得这份工作对我来说是小事一桩。(a piece of cake)I think(that)this job is a piece of cake for me4、他为自己拥有这张著名的CD感到非常自豪。(proud)He is very proud having this famous CD.5、当火车驶进车站时,乘客们很高兴这趟旅们途终于结束了。(pull into)When the train pulled into the station, the passengers were happy that the journey was finally over 15页 1、As a secretary, you should know how to set up appointments.作为秘书,你应该知道如何安排约见 2、Finding a time that suits everyone is going to be very difficult.找到一个适合每个人的时间将是非常困难的。 3、I will cook more food just in case my friends stay for dinner.我要多做点饭菜,以备万一我的朋友留下来吃晚饭 4、If a change is needed to be made, please contact me as soon as possible如果需要做变动,请尽快联系我。 5、You have given me a couple of phone numbers.Which one do you use often?你给了我好几个电话号码,你经常用哪个号码? 22页 1、她是位天生的音乐家。She is a natural musician/ she was born a musician2、那正是做此事的方法。That is the way to do it.3、这个房间足够大可以开晚会吗?Is the room big enough for a party? 4、看电影是乐事,而制作电影则是苦事。Watching a film is pleasure, but making one is hard work.5、尽管玛丽经常嘲笑杰克,他还是很喜难她。Even if Mary often laughs at Jack.he likes her very much.6、他说的话伤了我们的感情。(主语为从句)What be said hurt our feelings.(His words) 7、他想帮助穷人和老人。(宾语为不定式)He wants to help the poor and the old8、我的答复是我不能接受你的邀请。(表语为从句)My reply /answer is that I can’t accept your invitation.9、她住在一间朝南的房间里。(定语为现在分词短语)She lives in a room facing the south10、你来时我会把相片给你看的。(状语为从句,间接宾语在直接宾语之前)When you come , I will show you the photo.34页 1.玛丽辞职是明智之举。(wise)It was wise of Mary to resign 2.她真粗心,又忘了锁门。(careless)It was careless of her to forget to cock the door again.3.汤姆那样说话是错误的。(wrong)It was wrong of Tom to say like that 4.你花这么多钱真是愚蠢。(stupid)It was stupid of you to spend so much money.5.他们决定放弃这个计划,真是疯了。(foolish)It was foolish of them to give up the plan 6.你让我们用你家的汽车,你真好。(kind nice)It was nice/kind of you to let us use your car.7.他真慷慨,给了服务员10美元的小费。(generous)It was generous of him to give a ten-dollar tip to the waiter 8.这男孩只要3分钟就知道怎么玩这个电脑游戏,真聪明。(clever)It was clever of the boy to know how to play the computer game only in 3 minutes 36页 1.把那张碟买回来更省钱。(economical)It might be more economical to buy the disk 2.你们能赶得上那趟火车吗?(in time)Will you be in time for the train? 3.我们长话短说吧,我还要开会呢。(brief)Let’s keep this conversation brief;I have a meeting to attend 4.我妹妹真是大方,买这么多东西送给她的朋友。(generous)It is generous of my sister to buy so many thing for her friends 5.对于这份工作,你要先考虑一下有什么喜欢和不喜欢的地方。(like;dislike)You should firs of all consider/ think about / about the job your likes and dislike.43页 1.It won’t hurt to make efforts and come up with your own ideas.做一番努力拿出你自己的主意总是没有什么害处的。 2.Running(经营)your own business usually involves working long hours.经营自己的公司常常意味着要长时间工作 3.Most customers appreciated the way their complaints(投诉)were handled.大多数顾客对其投诉得到处理的方式表示赞赏。 4.We must get there all means before he has a chance to tell the news to her.我们务必尽一切可能在他有机会把消息告诉她之前赶到那里。 5.Students should understand that to fail in an exam is not the end of the world.学生们应该明白,一门功课不及格并不是大难临头。1 49页 1.冬季白天短,夜晚长。In winter, the days are short and the nights are long.2、他把车票拿给列车员看。He showed the ticket to the conductor.3、这个报告听起来很有意思。The report sounds interesting.4、他的父母给他取名为John。His parents named him John.5、我们大家都认为他是诚这实的。All of us considered him honest.6、全世界每天都在发生这种事情。Things of that sort are happening all over the world every day.7、那位先生能流利地说3种语言。That gentleman can speak three languages fluently.8、我要请人把我的电脑修理一下。I’ll get my computer mended/ fixed.9、每天早晨我们都听到他在声朗读英语。Every morning we hear him read English aloud.10、我的家乡在过去的10年里发生了巨大的变化。Great changes have taken place in my home town in the past ten years.64页 1、在夜里和乎无法看清道路。(barely)He could barely see the road at night.2、非常感谢你多年来对公司的忠诚。(loyalty)Thank you very much for your years of loyalty to the company.3、维护这栋房子很难,因为它太大了。(maintain)It is very difficult to maintain the house, as it is too large.4、俱乐部免费赠送T恤衫,以吸引年轻人加入。(give away;tempt)The club gives away T-shirts for free to tempt young people to join.5、他昨天穿了一件黑夹克,与他经常的花衬衣形成鲜明对比。(present a contrast to)He wore a black jacket yesterday, presenting a sharp contrast to the colored shirts he usually wears.70页 1、他离开办公室,非常失望。He left the office, very disappointed.2、玛丽慢慢推开门,既紧张又害怕。Mary opened the door slowly , nervous and frightened3、那个小男孩站在黑板前面,兴奋而自豪。The child stood before the blackboard, excited and proud.4、今天下午他来到我家,疲惫不堪,一声不吭。He came to my house this afternoon, exhausted and silent.5、我找到他时,他正躺在草地上,既满足又高兴。When I found him, he was lying on the grass, satisfied and happy.71页 1、Don’t be too hard on your child.别对你的小孩太苛刻了。 2、I think she is kind but rather childish.我认为她善良,但相当孩子气。 3、I wanted to calm them down but failed.我想让他们安静下来,但没有成功。 4、“Please forgive me,” she pleaded.“I’ll never do it again.”“请原谅我”,她恳求道“我再也不这样了”。 5、He looked up and found the teacher was looking at him angrily.他抬起头,发现老师正生气地看着他.79页 1、那房子面对公园。The house faces the park.2、别忘了查你的电子邮件。Don’t forget to check your e-mails.3、坐在前排的那个女孩是谁?Who’s that girl in the front row? 4、赶快,不然你就赶不上火车了。Hurry up, or you won’t catch the train.5、我不明白他为什么来得那么晚。I can’t understand why he was so late.6、那是一幢多么漂亮的建筑物啊!What a fine/ beautiful building(that is)! 7、坐直,孩子们!别靠在桌子上。Sit up straight, children!Don’t lean over the table.8、好黑的一个夜晚啊!我不敢出去。What a dark night(it is)!I am afraid to go out.9、我们乘公共汽车去还是坐火车去?Shall we go by bus or by train? 10、罗比并没说他要来参加晚会,是吗?Robbie didn’t say that he would come to the party, did he? 92页 1、他坚持认为自己的信仰(belief)是唯一正确的信仰。He insists that his belief is the only right one.2、我只有在收到报告后才能给你准确的数字。Only after I have received the report can I give you ask John to come too? 3、我8点钟与你见面。顺便问一声,你能叫约翰也来吗?(by the way)I’ll meet you at 8 o’clock.By the way , could you ask John to come too? 4、这个坏消息很快成了小镇上每个家庭的谈论话题。(topic)The bad news quickly became the topic for every family in the town.5、在过去1个月时间里,至少有15个人遭到抢劫(rob)。(in the course of)At least 15 people were robbed in the course of the past month.99页 1、你该做作业了。It’s time(for you)to do(your)homework.Or: It is time for your homework.2、该关灯睡觉了。It’s time to turn off the light and go to sleep.3、该吃早饭了。It is time to have breakfast.Or: It is time for breakfast.4、该汤姆发言了。It is time for Tom to give a speech.5、到时间了,开会吧。It is time to start the meeting.Or: It is time for meeting.6、是到了该对你说出真相的时候了。It’s time to tell you the truth.1.I have waited for you at least an hour.我等了你至少一个小时了。 2.I’ll wake you up when it’s time to leave.到了出发时间我会叫醒你的。 3.It was apparent to all that he was guilty(有罪的)。很显然他是有罪的。 4.Susan tried to smile, but her voice gave her away.苏珊努力地想笑一笑,但她的嗓音暴露了她内心的感受。 5.Try to think about something happy when you’re down in spirits.情绪低落时就尽量想一想快乐的事情。 页 1、他以前从未开过汽车。He has never driven a car before.2、琳达又把她的护照给丢了。Linda has lost her passport again.3、今天已经喝了4杯咖啡了。I’ve already drunk four cups of coffee today.4、如果不下雨,我要去买东西。I will go shopping if it doesn’t rain.5、最近你有收到乔治的来信吗?Have you heard from George recently? 6、自从她到这里她交了很多朋友。She has made many friends since she came here.7、在周未,我总是睡到午饭时间才起床。On weekends, I never get up until lunch time.8、你现在见不到史密斯先生,因为他正在休息。You can’t see Mr.Smith now because he is resting.9、电话持续响了一分钟了,为什么不接听?The telephone has been ringing for almost a minute.Why not answer it? 10、比尔又在给他女朋友打电话。这是他今晚第3次打电话给她了。Bill is phoning his girlfriend again.That’s the third time he’s phoned her this evening.122页 1、她总能想出好主意。(come up with)She can always come up with good ideas.2、你最好带上地图以防迷路。(in case)You’d better take a map in case you get lost.3、他为自己没有放弃动而感到骄傲。(be proud of)He was proud of himself for not giving up.4、他讲起英语来好像他是个美国人。(as though)He speaks English as though he were an American.5、他参加了这场英语演讲比赛,而且赢了。(take part in)He took part in the English speech contest and he won.6、I’m in love with you with all my heart.我全心全意地爱着你。 7、Since my father quit his job, we didn’t dine out often.自从我父亲辞职后,我们就不常在外吃饭。 8、She glanced at me in silence, and her face revealed nothing.她无声地瞥了我一眼,面无表情。 9、My alarm clock didn’t work and I slept in for nearly an hour.我的闹钟坏了,我睡过头近1小时。 10、They continued to keep in contact with each other otter they graduated.毕业后他们仍然继续保持联系。 136页 1、What you said just now reminds me of your father.你刚才说的话令我想起了你的父亲。 2、Her face lit with pleasure when she heard the news.听到这条消息,她脸上洋溢着快乐的光芒。 3、Out of habit, I go out for a walk after dinner every day.出于习惯,我每天晚饭后出去散步。 4、He still went ahead with the experiment, even though he knew it was dangerous.尽管知道有危险,他仍然继续实验。 5、When we’re together all he talks about is his work.I wish he were more romantic.我们在一起时,他光谈他的工作。我希望他更浪漫些。147页 1、他说如果明天没课他要来看你。He said he would come to see you if he had no class tomorrow.2、停电时我们正在测试一台新机器。We were testing a new machine when the electricity went off.3、他们午饭后出去了,现在才刚回来。They went out after lunch and have just come back.4、到昨晚9点钟时我已经读完了这本小说。I had already finished reading the novel by 9 o’clock last night.5、我相信我到达机场时,我的全家都将在等着我。I believe when I arrive at the airport, my whole family will be waiting for me.6、伊评测(Ian)在苏格兰信过10年。现在他已不信在那儿了。Ian lived in Scotland tor ten years.Now he’s not living there.7、当他们的第一个孩子出生时,他们已经结婚3年了。When their first child was born, they had been married tor three years.8、我们现在晚了。等我们赶 到电影院时电影将会已经开始。We are late now.The film will have already started by the time we get to the cinema.9、我一直在这学习了4年。所以到明年夏天我就已经毕业了 I have been studying here for four years , so by next summer I shall have graduated.10、我一开始还以为自己做得对,但马上就意识到自己犯了一个严重的错误。At first I thought I’d done the right thing, but I soon realized that I’d made a serious mistake.161页 1、公司正在找具有音乐天赋的年轻女孩。The company is trying to find young girls with a talent for music.2、要想知道真相,你就得揭开这些秘密。(unlock)If you want to know the truth, you have to unlock the secrets.3、玛丽很擅长学外语,因为她生来就记性好。(be born with)Mary is good at learning a foreign language since she was born with a good memory.4、夫妇俩对彼此都很坦率,这是他们幸福婚姻的关键(key)。(open)The couple are open with each other and that’s the key to their happy marriage.Or: The couple are open with each other and that’s the key to their happy marriage.5、这个歌手唱得很好,赢得了观众的热烈掌声(applause)。(perform)The singer performed beautifully/ wonderfully and won big applause from the audience.168页 1、He worked so hard that eventually he fell ill.他工作太卖力,最膈自己病倒了。 2、We can do the job well if we put our mind to it.如果我们把心思放在工作上,就能够把它做好。 3、She takes to reading English in the park every morning.每天早晨她喜欢在公园读英语。 4、I never expected life in the countryside would be so colorful.我从没想到乡村生活会如此丰富多彩。 5、He is a smart businessman, who knows the best place to sell his products.他是个精明的高人,知产道哪里最适合销他的产品。176页 1、据说那封信已经写完了。It is said that the letter has been written.2、这条消息过去从未听说过。This news has never been heard before.3、所有的试卷都批改(mark)完了。All the papers have been marked.4、冬天这个地区完全被大雪覆盖着。This region is completely covered with snow in winter.5、那个盗贼(thief)昨天已经抓到了。The thief was caught / arrested yesterday.6、其他问题也需要在明天的会议会上讨论。Other problems also need to be discussed at the meeting tomorrow.7、在那次空难中有128人鲁难罹难,59人受伤。128 people were killed and 59 people injured in the air crash.8、电视是什么时间、什么地方、由谁发明的?When, where, and by whom was the television invented? 9、这张桌子是钢制的,非常结实,上面可以站人。The table is made of steel and it is firm enough to stand on.10、我的那批贷(goods)已经发出(deliver)了吗?Have my goods been delivered? 195页 1、I was moved by your loving concern for my son.你对我儿子充满爱意的关怀令我感动。 2、I was annoyed with myself for giving in so easily.我为自己如此轻易地让步而感到懊恼。 3、I used to stay up late watching movies with my roommates.我过去常常和我的室友们一起熬夜看电影。 4、He was very reluctant to tell the police everything he knew.他很不情愿地告诉警察他所知道的一切。 5、It matters a great deal to her what other people think of her.别人怎么看她对她来说很重要。 205页 1、他今天无需上课。(need)He needn’t go to school to day./ He doesn’t need to have a lesson / He needn’t have a lesson.2、昨晚一定下过雨。(must)It must have rained last night.3、杰克现在该到家了。(ought to)Jack ought to be home by now / Jack ought to have got home by now.4、你本来不该做那件事。(should)You should not have done it / You should not have done that thing.5、他可能忘了给她回电话了。(may)He may have forgotten to call/ ring her back.6、汤姆也许已经离开巴黎了。(might)Tom might/ may have left Paris.7、我不敢让父母知道那知消息。(dare)I dare not(don’t dare to)let my parents know the news.8、他们本不应该买下那栋房子。(should)They should not have bought that house.9、如果你能来,我们会非常高兴。(could, would)If you could come, we would be much pleased/ happy.10、你能否把自行车借给我用一下,明天就还?(could) 217页 1、我们对大脑知之甚少,认识到这一点至关重要。(vital, recognize)It is vital to recognize how little we know about our brain.2、我们在家里过个安静之夜的期望被客人的到来给破坏(ruin)了。(expectation)Our expectation of having a quiet night at home was ruined(毁坏)by the arrival of guests.3、现在你已身处现实世界,开始职业生涯时机已到。(it is time to …….., get sth started)You are now in the real world and it’s time to get your professional life / career started.4、一旦确定了你中意的公司,最好浏览该司网站以获得尽可能多的信息。(once)Once you have identified companies that you like, you’d better visit their websites to learn as much as you can.5、倘若你对自己的未来还确定,就应该找到你最感兴趣的是什么。(be certain about, identify)If you are not certain about your future, you should identify what interests you most.224页 1、Take your time, Madam.More haste, less speed.慢慢来,夫人。欲速则不达。 2、They can easily make room for you to sit at this table.他们很容易就能为你腾出位置在这张桌子边坐下来。 3、Fold up your clothes and don’t just throw them on the floor.把你的衣服叠起来,别就这么扔在地板上。 4、You haven’t done the job properly -you’ll have to do it again.这件工作你没有做好,你得重来。 5、He has done so much in such a short time that everyone thinks that it’s a miracle(奇迹)他在这么短的时间里取得了如此大的成就,大家都 认为这是奇迹。 233页 1、我很能过,因为你误解我了。(understand)I was very upset because you misunderstood me.2、玛丽的儿子正变得越来越独立。(depend)Mary’s son is becoming more and more independent.3、每个人都难以忘怀童年的黄金岁月。(gold)It’s difficult for everyone to forget the golden years of childhood.4候选人的承诺使许多选举人上当受骗。()The candidate’s promises misled many voters.5、她发现这份工作并不像她想象的那样简单。(cover)She discovered the job wasn’t as easy as she had imagined.6、他正努力使这个村庄的电话系统现代化。(modern)They are trying to modernize the telephone system of the village.7、这个故事里的英语被简写了,可更容易理解。(simple)The English in this story has been simplified to make it easier to understand.8、他们正在尽力把讨论的内容扩展到包括环境问题。(wide)They are trying to widen the discussion to include environmental issues.9、从历史背景(historical context)来研读这部小说是非常重要的。(history)It is important to read the novel in its historical context.10、尽管遭到警察毒打并被投入监狱,甘地(Gandhi)创立了非暴力抵抗(resistance)原则。(violent)Though beaten by the police and sent to jail , Gandhi invented the principle of nonviolent resistance.249页 1、我们应该在10天之内完成这个任务。(be supposed to)We are supposed to finish the task in ten days.2、为了跟上时事,他每天都阅读报纸或者看电视。(keep up with)Every day he reads newspapers or watches TV in order to keep up with current events.3、火车有可能晚点,因为现在正在下大雨。(be likely to)The train is likely to be late, for it is raining heavily/ hard.4、比赛前的那个晚上,我一直睡不着,因为我担心我会输。(lie awake)On the night before the match, I lay awake, because I was worried that I might lose.5、他从底层做起,后来经过努力而取得成功。(at the bottom;work one’s way up to)He started at the bottom and then worked his way up to success.6、His father likes to respond to his questions by telling him to wait for a while.他的父亲喜欢在回答他的问题时叫他稍等会儿。 7、Don’t worry.I am sure I will find a job soon and then our life will be better off.别担心。我肯定会很快找到一份工作的,那样我们的生活就会好些。 8、She talks to me as if she were my boss.她跟我说话,(那口气)就好像她是我的老板一样。 9、Hearing my congratulations on her success, she was very happy.听到我祝贺她成功,她非常高兴。 10、Being out of work and having tow young children, the Smiths found it impossible to make ends meet.由于失业,还要养活两个年幼的小孩,史密斯夫妇无法维持起码的生活。 1)杰克对书架上那些书一本也不了解,所以他的选择是很随意的。 Jack didn't know anything about any of the books on the bookshelf, so his choice was quite arbitrary.2)如果有机会,约翰也许已成为一位杰出的画家了。(given) Given the chance, John might have become an outstanding painter.3)许多美国大学生申请政府贷款交付学费。 Many American students apply for government loans to pay for their education / tuition.4)提问常常会引发创造的火花。 Asking questions often generates the spark of creativity.5)就能力而言,我肯定他能胜任这件工作。 As far as ability is concerned, I am sure he will qualify for the job.6)在西方,人们常常邮购商品,这可以节省许多时间。 In the West, people often send away for mail-order goods, which can save a lot of time.7)Instead of studying people who were sick with smallpox ,he began to studypeople who were exposed to it but never got sick.he found that they’d all contracted a similar but milder disease ,cow pox ,which vaccinated them against the deadly smallpox.他不去研究得了天花的患者,而是去研究接触天花却从未染上此病的人。他发现他们都患了一种类似天花但比较轻微的疾病:牛痘;这使得他们对致命的天花得以免疫。 8)We are not now, nor have we recently been suffering from a lack of information.Think how much more information we have than Copernicus had four centuries ago.And he didn’t do anything less Earth-shattering(pun intended)than completely change the way the universe was viewed.He didn’t do it by uncovering more information--he did it by looking differently at information everyone else already had looked at.Edward Jenner didn’t invent preventive medicine by accumulating information;he did it by reframing the question.无论是现在还是最近,我们都不缺信息。试想我们拥有的信息比四百年前的哥白尼多了多少。但他作出了足以震撼地球的(权作双关语)惊人之举,完全改变了人们对宇宙的看法。他作出此举不是靠发现更多的信息,而是靠用不同的眼光来看大家都看到过的信息。爱德华·詹纳不是靠积累信息发明预防药物,而是靠重新表述问题。 9)But it wasn’t a shed.it was a house,a decaying shanty surrounded by tall grass and junk.但这不是一个工具棚,这是一所房子,一个被高高的杂草和废弃物包围的正在朽烂的小棚屋。 10)But that smile!It cut through the gloom of the battered wooden floor,the torn couch and the cobwebbed windows.可她那微笑里充满了光芒!它穿透了由破烂的木地板、旧躺椅和结满蜘蛛网的窗户围起来的黑暗空间。 3)杰克对书架上那些书一本也不了解,所以他的选择是很随意的。 Jack didn't know anything about any of the books on the bookshelf, so his choice was quite arbitrary.4)如果有机会,约翰也许已成为一位杰出的画家了。(given) Given the chance, John might have become an outstanding painter.3)许多美国大学生申请政府贷款交付学费。 Many American students apply for government loans to pay for their education / tuition.4)提问常常会引发创造的火花。 Asking questions often generates the spark of creativity.5)就能力而言,我肯定他能胜任这件工作。 As far as ability is concerned, I am sure he will qualify for the job.6)在西方,人们常常邮购商品,这可以节省许多时间。 In the West, people often send away for mail-order goods, which can save a lot of time.7)Instead of studying people who were sick with smallpox ,he began to studypeople who were exposed to it but never got sick.he found that they’d all contracted a similar but milder disease ,cow pox ,which vaccinated them against the deadly smallpox.他不去研究得了天花的患者,而是去研究接触天花却从未染上此病的人。他发现他们都患了一种类似天花但比较轻微的疾病:牛痘;这使得他们对致命的天花得以免疫。 8)We are not now, nor have we recently been suffering from a lack of information.Think how much more information we have than Copernicus had four centuries ago.And he didn’t do anything less Earth-shattering(pun intended)than completely change the way the universe was viewed.He didn’t do it by uncovering more information--he did it by looking differently at information everyone else already had looked at.Edward Jenner didn’t invent preventive medicine by accumulating information;he did it by reframing the question.无论是现在还是最近,我们都不缺信息。试想我们拥有的信息比四百年前的哥白尼多了多少。但他作出了足以震撼地球的(权作双关语)惊人之举,完全改变了人们对宇宙的看法。他作出此举不是靠发现更多的信息,而是靠用不同的眼光来看大家都看到过的信息。爱德华·詹纳不是靠积累信息发明预防药物,而是靠重新表述问题。 9)But it wasn’t a shed.it was a house,a decaying shanty surrounded by tall grass and junk.但这不是一个工具棚,这是一所房子,一个被高高的杂草和废弃物包围的正在朽烂的小棚屋。 10)But that smile!It cut through the gloom of the battered wooden floor,the torn couch and the cobwebbed windows.可她那微笑里充满了光芒!它穿透了由破烂的木地板、旧躺椅和结满蜘蛛网的窗户围起来的黑暗空间。第三篇:英语翻译复习
第四篇:英语翻译题
第五篇:英语翻译题