第一篇:C程序题库+几种句型+小结
常见的错误类型:
1、您的程序想从一些非法的地址空间读取或向其中写入内容。一般例如指针、数组下标越界都会造成这个错误的。
2、您的程序试图访问一个超出硬件支持范围的数组单元。
3、进行了一个非正常的浮点操作。一般是由于一个非正常的浮点数参与了浮点操作所引起的,比如这个数的浮点格式不正确。
4、浮点数除法出现除数为零的异常。
5、在进行整数除法的时候出现了除数为零的异常。
6、栈溢出。一般是由于无限递归或者在函数里使用了太大的数组变量的原因。
小结归纳及错误检查
1.输入看是否漏掉符号“&”。括号是否成对。
2.判断素数时要弄清1是不是素数,判断偶数时要弄清0是不是偶数,部分题目中情况会有变化
3.多组测试数据中每次数据是否初始化。
4.程序开始部分有没有加声明。如复杂数学计算时要加上“#include
几种句型
1.数字输入输出语句
Input
输入一个整数。
Output
输出刚才输入的那个整数,并换行。
#include
没有输入
Output
输出%d
#include
3.字符输入输出语句 Input
输入一个字符,以回车确认
Output
输出你刚才输入的字符
#include
4.字符串输入输出语句//利用ascall码表输出特殊字符 Input
输入一行字符,中间可能有空格,回车表示输入完毕。
Output
输出也为一行,输出刚才输入的内容。
#include 5.多组测试数据简单计算 Input 多组测试数据,每组输入两个整数a和b Output 输出a+b的值,并换行 #include 输入正整数n Output 输出1+2+3+...+n的值 #include 7.双层循环语句 Input 输入正整数n Output 输出n*n的乘法口诀表 #include 8.if条件语句 Input 输入2个整数,Output 输出两个数中较大的那个数 #include 9.多层if条件语句 Input 输入3个整数,Output 从大到小输出,中间用空格隔开 #include 10.一维数组 Input 多组测试数据。第一行输入一个整数T表示测试数据组数 每组首先输入1个整数n,然后输入n个整数(不大于20) Output 对于每组测试数据按照输入相反的顺序输出n个数据 #include 11.二维数组 Input 多组测试数据 每组输入2个整数 n和m(不大于20) Output 输出n*m的矩阵,要求左上角元素是1,然后从左到右 从上到下依次增大 #include 12.switch语句 Description 要求根据以下函数关系,对输入的任意整数x,计算出相应的y值。要求用switch语句实现。 x的值 y的值 x<0 y=0 0<=x<10 y=x 10<=x<20 y=10 x>=20 y=30 Input 输入的任意整数x Output 计算出相应的y值 #include 13.函数语句 Input 多组测试数据,每组输入一个整数。 Output 当x > 0时,输出函数值为1; 当x = 0时,输出函数值为0;当x < 0时,输出函数值为-1。 #include 14.指针语句 Input 多组测试数据。每组测试数据输入2个整数。 Output 对于每组测试数据,从大到小输出数 #include 15.指针与数组结合语句 Description 调用自定义后移函数move(int *a, int n, int m)来进行循环移位,对n(n<20)个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面m个数,如下: n=10, m=3时:输入:1 2 3 4 5 6 7 8 9 10,输出:8 9 10 1 2 3 4 5 6 7 Input 输入多组测试数据,每组先输入n(n < 20)和m(m < n),再输入n个整数。 Output 输出循环移动m个数后的序列,数据间空格隔开。 #include 16.字符串的多组测试 Input 多组测试数据,每组输入一个以回车结束的字符串(少于80个字符)。 Output 将这个字符串颠倒过来输出 #include 16.待续......C程序设计若干题 001 ——摄氏温度转换 输入华氏温度f,输出对应的摄氏温度c,保留3位小数。 c=5/9*(f-32)Input 输入f Output 输出c #include //输出格式为保留3位小数 return 0;} 002 ——整除 Input 输入三个整数,分别为a,b,c(其中b,c均不为0) Output 如果a既是b的整数倍又是c的整数倍,则输出Yes,否则输出No #include 003 ——求正弦和余弦 Input 输入一个正整数(不大于10000) Output 分2行分别输出n度的正弦和余弦函数值,保留2位小数 #include 004 ——求多项式(含浮点)Input 输入一个整数n Output 输出1+1/(1-3)+1/(1-3+5)+...+1/(1-3+5-...+2n-1)的值,保留2位小数 #include 005 ——调用函数,输出100到200之间的所有素数 Input 无 Output 输出100与200之间的所有素数,每行输出5个数,每个数占5位。#include 006 ——求方程的解 Description 求ax2+bx+c=0方程的实根。a,b,c由键盘输入.Input 输入三个数a,b,c Output 输出方程的实根,如果方程有实根,则输出根;如果方程有2个不等实根,则分2行输出,第一行输出较大根,第二行输出较小根。 其余情况(如无实根等)则输出No #include 007 ——N个数找最大和最小值 Input 多组测试数据 首先输入1个整数n表示测试组数 然后每行首先输入1个整数m,再输入m个整数 Output 对于每组测试数据输出1行,内容为m个整数的最大值和最小值 #include max=min=num;if(max 008——指针:调用自定义交换函数,完成5个浮点数从小到大排列 Input 多组测试数据,每组输入5个任意浮点数。 Output 输出从小到大排列的5个数,输出一位小数,数据之间空格隔开。#include void swap(float *p1,float *p2){ float t;t=*p1;*p1=*p2;*p2=t;} int main(){ float a[N];int i,j; while(scanf(“%f%f%f%f%f”,&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){ for(i=0;i<4;i++){ for(j=0;j<4-i;j++){ if(a[j]>a[j+1]){ swap(&a[j],&a[j+1]);} } } printf(“%.1f %.1f %.1f %.1f %.1fn”,a[0],a[1],a[2],a[3],a[4]);} } 009——第几天 Input 输入为一行输入格式为YYYY-MM-DD Output 输出这天是这一年的第几天 #include 010——逆序输出 Input 输入一个不多于5位的正整数 Output 输出分2行,第一行是一个整数,输出是几位数,第2行逆序输出 #include 011—— 打印双层金字塔 Input 多个测试数据。每个测试数据输入一个整数n(2 <= n <= 9) Output 输出双层金字塔。 #include 012——删除操作 Input 输入一行以回车结束的字符串str1(少于80个字符)和一个字符串str2(少于80个字符)。 Output 输出完成删除字符串str2后的字符串。如果待删除的str2不在str1中,则不进行删除操作,输出原来的str1。#include { gets(str2);len1=strlen(str1);len2=strlen(str2);for(i=0;i { if(str1[i]==str2[j]){ x=i;y=0;for(y=0;y { if(str1[x]!=str2[y]){break;} else {x++;} } } } if(y==len2){ i=i+j-1;} else {printf(“%c”,str1[i]);} } printf(“n”);} } 013——调用函数,判断各位数字和是否等于它本身 Input 多组测试数据,每组输入两个正整数m和n(m>=1, n<=1000)。 Output 输出m-n之间的所有满足各位数字和等于它本身的数,“%d ”形式输出 #include 014—— 函数调用,统计数中'2’的个数 Input 多组测试数据,每组输入一个整数。 Output 输出该数中'2'的个数。#include 015——数组中插入一个数 Input 多组测试,每组第一行输入一个整数n,然后是n个有序的整数 第二行输入1个整数m和1个整数K Output 将整数m插入到原数组中保持顺序是升序,然后输出2行 第一行是插入以后的数组 第二行是插入以后的数组中下标值是K的数 n m k不超过20 #include 016——偶数排序 Input 多组测试数据,每组输入一个正整数N(1≤N≤100)和N个整数,用空格分隔。 Output 将这N个数中的偶数按从大到小的顺序输出 #include printf(“%d ”,b[i]);} printf(“n”);} } 017——弓型矩阵 Input 多组测试数据 每组输入2个整数 n和m(不大于20) Output 输出n*m的弓型矩阵,要求左上角元素是1,(每个元素占#include 2个位置,靠右)for(i=0;i 018—— 找出一个数组中出现次数最多的那个元素 Input 第一行输入一个整数n(不大于20) 第二行输入n个整数,Output 找出n个整数中出现次数最多的那个整数 #include 019—— 指针:自定义函数sumDiff(),调用它来求两个数的和、差 Input 多组测试数据,每组输入两个任意整数。 Output 输出两个数的和与差,空格隔开。 #include *pSum=op1+op2;*pDiff=op1-op2;} int main(){ int a,b,c,d; while(scanf(“%d%d”,&a,&b)!=EOF){ sumDiff(a,b,&c,&d);printf(“sum=%d diff=%dn”,c,d);} } 020——统计各种字符个数 Input 输入一行字符,以回车符结束 Output 分别输出字母、空格、数字和其它字符的个数 #include It 句型小结 1.It is/was + 被强调部份 + who/ that + 句子的其它成份 2.It be/become + adj./n.+(for sb.)+ to do…/ that… 3.It took/was/will take/will be + 一段时间 + before… 过多久才(就)…, …之后才… 此句型中谓语动词多用过去时和将来时.4.It is time + for sth./ to do sth./ that … 该是…的时候了。 后接that从句时谓语动词常用过去式或should+动词原形 5.It is the first/second…time(that)… 第一/二次… 由于time前有序数词修饰,从句谓语动词常用完成时态,且和主句时态保持一致。 6.It looks/seems as if … 看起来好像… 7.It is said/reported/thought/considered/believed/announced/expected… + to do…/that… 据说/据报道/据认为/据相信/据宣布/据期望… 8.It takes(sb.)some time to do sth.做某事花费多少时间 9.It is no use/good + doing sth.做某事是没用/好处 10.It seems/looks/appears/happens + that … 似乎/看起来/好像/碰巧 11.think/make/believe/find/feel/consider+ it + adj./n.+ to do/doing/that-clause There be句型的小结 1.There used/seem/ happen/appear to be 2.There is no sense in doing 做某事是没有用的,没有意义的 3.There is no use /good doing 做某事是没有用的,没有必要的 4.There is no need to do 没有必要做某事 5.There is thought/said/reported to be 人们认为有/据说有/据报道有 6.There is no doing(口语)不可能……. 1.It is + 被强调部分 + that...该句型是强调句型。将被强调的部分放在前面,其它部分置于that之后。被强调部分可以是主语,宾语,表语或状语。强调的主语假如是人,that可以由who换用。假如把这种句型结构划掉后,应该是一个完整无缺的句子。这也是判定强调句型与其它从句的方法。It was about 600 years ago that the first clock with a face and an hour hand was made.It was they that(who)cleaned the classroom yesterday.It was in the street that I met her father.2.It is not until + 被强调部分 + that...该句型也是强调句型。主要用于强凋时间状语,译成汉语"直到...才...",可以说是 not...until...的强调形式。 It was not until she took off her dark glasses that I realized she was a famous film star.= Not until she took off her dark glasses did I realize she was a famous film star.= I didn’t realize she was a famous film star until she took off her dark glasses.3.It is clear(obvious, true, possible, certain....)that.....该句型中it 是形式主语,真正的主语是that 引导的主语从句,常译为"清楚(显然,真的,肯定...)" 是主语从句最常见的一种结构。It is very clear that he’s round and tall like a tree.= That he’s round and tall like a tree is very clear.4.It is important(necessary, right, strange, natural...)that...该句型和上一个同属一个句型。由于主句中的形容词不同,that 后的从句中要用虚拟语气(should + 动词原形),should 可以省去。建议记住该句型中的形容词。It is important that we(should)learn English well.It is necessary that he(should)remember these words.5.It is said(reported, learned....)that...该句型中的it 仍是形式主语,真正主语是that 引导的主语从句。该结构常译为"据说(据报道,据悉...)"。 It is said that he has come to Beijing.It is reported that another earth satellite has been put into orbit.6.It is suggested(ordered...)that...该句型和上一个同属一个句型。主句中的过去分词是表示请求,建议,命令等词时,that 后的从句要用虚拟语气(should + 动词原形),should 可以省。常译为"据建议;有命令...) It is suggested that the meeting(should)be put off.It was ordered that we(should)arrive there in two hours.7.It is a pity(a shame...)that...该句型中,that后的从句一般用虚拟语气(should + 动词原形),should可省去.表示出乎意料,常译为"竟然"。没有这种意义时,则不用虚拟语气。It is a pity that such a thing(should)happen in your class.这种事竟然发生在你们班上,真是遗憾! It is a pity that he is ill.他生病了,真遗憾! 8.It is time(about time ,high time)that...该句型中that 后的从句应该用虚拟语气,值得注重的是① 常用过去时态表示虚拟.② 有时也用should + 动词原形,should 不能省。常译为"是(正是)...的时侯..."。 It is time that children should go to bed.= It is time that children went to bed.9.It is the first(second...)time that...该句型要和上一个句型区别开来。该句型中的 that 从句不用虚拟语气,而用完成时态。至于用什么完成时态,由主句的谓语动词的时态决定。假如是一般现在时,后面从句用现在完成时态;假如是一般过去时,后面从句则用过去完成时态。该结构中 that 可以省去;it有时用 this 替换.常译为"是第一 (二)...次..."。It is the first time I have been here.= This is the first time I have been here.10.It is....since...该句型主要用作处理瞬间动词的完成时,又要和表示一段时间的时间状语连用的问题。主句中是时间作表语,其时态是现在时或完成时,since 引导的从句通常是一般过去时态,而且是瞬间动词。假如主句是一般过去时,从句则用过去完成时。It is(has been)5 years since his father died.11.It is...when...该句型中的 when 引导的是一个时间状语从句,主句中的 it 指时间,表语由具体的时间充当。常译为"当...的时候,是..."。 It was 5 o’clock when he came here.12.It be...before...该句型主句中的 it 指时间, 主句中的时态常是将来一般时或过去时两种时态.主句中的表语多是long, not long , 3 days , 2 weeks 等表示时间段的词或短语。常译为"...之后..."。 It was 3 days before he went to Beijing.It will be not long before he finishes his job.13.It happens(seems, looks, appears)that...该句型中it是形式主语,that 引导的是主语从句,主句中的happen , seem等词是不及物动词. It happened(so happened)that he met his teacher in the street.碰巧.. It seems that he will be back in a few days.看来... 14.It takes sb....to do sth.该句型中的不定式是真正的主语,it是形式主语,句型中的直接宾语是时间。常译为"做...要花费某人..."。 It took thousands of people many years to build the Great Wall.15.It is no good(use)doing sth.该句型中的真正主语是动名词短语,主句中的表语可以是no good ,(not any good), no use ,(not any use)。 It is no good learning English without speaking English.16.It doesn’t matter whether(if)...该句型中whether(if)引导的从句是真正主语,该句型常译为 "不论(是否)...没关系...。 It doesn’t matter if they are old.17.It is kind(of sb.)to do sth.该句型中的不定式短语是真正主语,假如不定式的逻辑主语是由 of引起,主句中的形容词必须是能表示逻辑主语特征的形容词。常见的有: bad , brave , careless, clever , cruel , foolish , good(好心的), honest , horrible , kind , lazy , modest , naughty , nice(有教养的), polite, rude , silly , stupid , wise , wrong(错误的)等。这个句型可以改写为:sb.is kind to do sth.It is kind of you to say so.= You are kind to say so.18.It is necessary(for sb.)to do sth.该句型与上一个同属一个句型。假如不定式的逻辑主语是由for引起,主句中的形容词通常是表示重要性,紧迫性,频繁程度,难易,安全等情况的形容词。常见的形容词有:① important, necessary, natural ② easy , safe , common , normal , hard , difficult , dangerous , unusual, rare , impossible , pleasant等。 在①中的形容词作表语可以用从句改写,如: It is important for her to come to the party.= It is important that she(should)come to the party 19.It looks(seems)as if...该句型中it无意义。as if 引导一个状语从句。常译为,"看起来好象..."假如与事实不相符合,则用虚拟语气. It looks as if he is ill.(真的病了) It looks as if he were ill.(没有生病) It seemed as if he were dying.20.We think it important to learn a foreign language.该句型中的it 作形式宾语。常用的动词:think, believe, make, find, consider, feel; We think it our duty to clean our classroom every day.He felt it important learning English well.They found it difficult that they would finish their work in two days. There be句型的小结 There be表示 “存在有”,即当我们告诉某人某事存在(或不存在)常用这种结构。其中there是引导词,本身无词义;be为谓语动词,后面跟的是名词,也就是主语,也就是说there be结构的运用也就是倒桩的具体运用。其真正的主语在there be 之后。在新课标中对此的考试要求是:掌握There be句式的结构特征和基本用法。在我们的课本中也出现了大量的There be句式如: There are a few simple safe measures to follow while training.There are also records of gymnastics being performed in China and some other Asian countries.There were lots of good English language programs broadcast on TV or on the radio in China.一、注意事项: there be 结构中的be 是可以运用各种时态的。 There is going to be a meeting tonight.。 There was a knock at the door.There has been a girl waiting for you.There will be rain soon.2动词be单复数形式要跟there be之后的真正的主语一致。并且要根据就近一致原则来变换be 的单复数形式。 如: There is a book on the desk.How many people are there in the city? There is a pen and two books on the desk.There are two books and a pen on the desk.3 在there be引起的句子结构中,用来修饰主语的不定式主动形式和被动形式均可。 There is no time to lose(= to be lost).时间紧迫 There is nothing to see(=to be seen).看不见有什么 There is nothing to do.(=to be done)无事可做。 二、结构变形: 在there be 结构中还可把be 改变从而使得there be结构有了一些改变具体总结如下:There used/seem/ happen/appear to be 如: There might be snow at night.There appeared to be nobody willing to help.There used to be a building here.There happened to be a man walking by.There doesn't seem to be much hope.在there be的 be 前还可以加上各种情态词,如: There must be something wrong.一定有问题。 There ought not to be so many people.不应该有这么多的人。 There might still be hope.可能还有点希望。在there be句型中的be还可以换成其他的动词与there连用,这些词都是表示状态的如:live stand exist remain等或用来描写某事的发生或某人的到达如come, appear, enter, follow, occur等。 There lived a rich man.Then there came a knock at the door.Long, long ago, there lived a king.There followed a terrible noise.Suddenly there entered a strange man.三、特殊的表达方式:1There is no sense in doing 做某事是没有用的,没有意义的 There is no sense in making him angry There in no sense in going alone.4 There is no use /good doing 做某事是没有用的,没有必要的 There is no use trying to explain it.There is no good/use going there.5 There is no need to do There is no need to worry.There is no need to give him so much money.6 There is thought/said/reported to be 人们认为有/据说有/据报道有 There is thought to be an army between in these two countries。 There is reported to be a better way to cure cancer.7 There is no doing(口语)不可能…….There is no telling when he will be back.无法知道他什么时候回来。 There is no knowing what he is doing.无法知道他在做什么。 四、there be句式的非限定形式。 There be 的非限定形式有两种,即there to be 和there being。需要掌握以下几个情况: 1作主语 当作主语时,一般是There being结构,当句式中有for时,一般用there to be如: There being a shop here is a great advantage.It is impossible for there to be any more.There being a house with a garden is of great value.2 作宾语 作动词宾语时,一般用there to be 结构。常见动词有:expect, mean, intend want, prefer等: We expect there to be no argument.People don't want there to be anther war.作介词的宾语一般用There being句式,但当是for时一般用there to be句式。 This depended on there being a sudden change.这需要有一个突然的改变。 The teacher was waiting for there to be complete silence.3 作状语 用作状语的there be的形式通常用there being结构。 There being no buses, we had to walk home.There being no nobody in the room, we realized that there was no use crying.There being nothing else to do, we went home happily.注意:如果句中出现for时应用there to be。 It was too late for there to be any buses.There be句型的多种形式及用法 1.There be与情态动词连用 There be句型中的谓语动词be可与各种情态动词连用,表示“一定有”、“可能有”、“应该有”等含义。如:There oughtn’t to be too great discrepancy in our views. He felt that there must be something wrong. There can’t have been much traffic so late at night. There might be drinks if you wait a bit. 2.There be与含有情态意义的动词或短语连用 英语中有些动词或短语具有一定的情态含义,我们称之为半助动词。There be句型中的谓语动词be 可与这些半助动词连用,表达更为复杂的意念。能用于There be句型中的这类词语主要有:happen to(碰巧),appear /seem to(似乎),be going to(将会),used to(曾经),have to(必须),be likely to(很可能),be bound to(必定)等。例如: There happened to be an old friend of mine in the club. There appear to be several reasons for changing our plans. There used to be a cinema here before the war. Is there going to be a dancing party tonight? There are bound to be obstacles for us to get over. 3.There be的非限定形式及用法 There be结构也可以以不定式(there to be)、动名词(there being)和现在分词(there being)的形式出现在句子中,作主语、宾语或状语。这种非限定形式中的there在形式上起着逻辑主语的作用,因此,不定式there to be前有时需加介词for,从形式上满足引出不定式逻辑主语的需要,而分词there being则具有独立主格结构的意味。例如: I don’t want there to be any more trouble.(不定式作宾语) I expect there to be no argument about this.(不定式作宾语) It was unusual for there to be so few people in the street.(不定式作主语) What’s the chance of there being an election this year?(动名词作介词宾语) There being a bus stop so near the house is a great advantage.(动名词作主语) There being nothing else to do,we went home.(分词作状语)4.由there be构成的固定句型 由there be构成的一些固定句型在英语中很活跃,需很好地掌握。常见的有: There is no point in +v-ing:没道理,没用,没必要 There is no use(in)+v-ing:毫无用处 There is no sense in +v-ing:毫无道理 There is no need to +v:没有必要 There is no +v-ing:不可能,无法。 例如: There is no use in hiding that fact from him . There is no point in arguing further. There was no mistaking his intentions this time. 5.there与其它动词连用 除动词be外,其它一些动词也可以与there连用。这些动词有两类:一类是表示存在概念的状态动词,如:exist,remain,live,lie,stand等;一类是表示某事发生或某人到达等概念的不及物动词,如:come,enter,arise,occur,follow,appear等。 admit句型小结 1.admit doing sth 承认做某事。如: I admit breaking the window.我承认打破了窗玻璃。 He admitted having stolen the money.他承认偷了这笔钱。 2.admit of 容许有,有……的余地,有……的可能。如: The matter admits of no delay.此事刻不容缓。 The word admits of no other meaning in the case.该词在此例中不可能有其它的意义。 3.admit to 承认。如: He admitted to the murder.他供认了谋杀罪。 He admitted to having taken the money.他承认拿了那笔钱。 注:由于 admit 表示“承认”可用作及物动词或不及物动词,所以上面各例中的介词 to 有时也可省略(省略 to 后 admit 为及物动词)。 4.admit…to(into)允许进入,使能进入。如: They admitted him to [into] their organization.他们接受他参加了他们的组织。 How many students have been admitted into the school this year? 今年这所学校有多少学生入学? 试比较(注意介词不同): He was admitted to(into)the Party.他被吸收入党。 He was admitted as a Party member.他被接纳为党员。第二篇:It 句型小结
第三篇:It句型小结
第四篇:There be句型的小结
第五篇:admit句型小结