in case 的用法

时间:2024.4.18

in case/in the case/in case of的用法及区别

(2007-09-16)

in case万一。是连词,引导条件状语从句。也就是说in case后面是一个完整的句子 Take a hat with you in case the sun is very hot. 倘若太阳很利害,你就把帽子戴上。 in case of的of是介词,介词后面只能带名词性质的词,比如名词、代词等。意思和in case差不多,万一的意思 In case of rain they can't go. 万一下雨,他们就不能去了。 in the case of,就...来说, 关于。意思跟上面两个不一样了。一般表示转而提及另一件事情。比如 In the case of woman,they have more difficulty in their job。就女性来说,她们在工作中会遇到更多的困难

1. We have an auxiliary generator in case of power cuts. 我们有一台万一断电时使用的备用发电机。

2. In case you need something, please don't hesitate to let me know. 如果你需要什么东西,请不客气地对我说。

3. It may rain you'd better take an umbrella (just) in case (it does). 可能下雨--你最好带把伞, 以防万一(下起来).

4. In case that he leaves, please inform me.

如果他离开, 请通知我。

5. In case of rain, they can't go.

万一下雨,他们就不能去了。

6. In case (=If) I forget, please remind me.

万一我忘记,请提醒我。

7. Write the telephone number down in case you forget.

把电话号码写下来以免忘了。

8. The doctor asked us to call him during the night except in case of necessity.

医生吩咐我们,除非必须,否则不要在夜里叫他。

一、case作名词的用法:

1. case有"情况、事实"之意。如:

Is it the case that you have lost all your money? 你的钱全都损失了, 是真的吗?

The police have a clear case against the prisoner. 警察有充足的事实对付那个囚犯。

case作此义时,常用于以下一些固定短语:

① in that / this case 如果那样/这样(的话);在那种/这种情况下

In that case, we'd better hold a discussion about the problem. 那样的话,我们最好对这一问题展开讨论。

He may not be back at six. In this case we won't wait for him. 他可能六点钟回不来。要是这样,我们就不等他了。

② in case of 如果, 万一,后接名词、代词或动名词。如:

Take a spare tyre along in case of need. 带只备用轮胎去,以备不时之需。 Turn off the TV set in case of thunderstorm. 在雷雨时,关上电视机。 In case of fire, dial 119 at once. 如果发生火灾,立即拨打119。 而in the case of则是"就……来说"。如:

In the case of his health, it is fortunate for him to have recovered from his illness like this. 就他的健康状况来说,能恢复到这样算是幸运的了。

Failure is no shame in the case of a scientist. 就科学家来说,失败并非羞耻事。

case的这种用法,请看20xx年的高考题: The sign reads "In case of fire, break the glass and push red button."

A. 不填;a B. 不填;the

C. the; the D. a; a

(字母下划横线的为正确答案)

③ in case 万一, 以防, 如果,引导条件状语从句。如:

In case he arrives before I get back, please ask him to wait. 万一我回来前他先到了,请叫他等我。

Please remind me of it again tomorrow in case I forget. 请你明天再提醒我一下,免得我忘记。

注意: in case引出的条件从句所表示的意义是"预防某种情况的出现";如果从句说的是一般的假设或条件,则要用if 。请比较:

I'll tell him about the matter if I meet him. (不用in case) Take an umbrella in case it rains. (不用if )

在上下文意义很明确时,有时可省去in case后从句的内容。如:

I don't think it will rain, but I'll take an umbrella in case (it rains).

请看高考题:

I don't think I'll need any money but I'll bring some ______ . A. at last B. in case

C. once again D. in time

(NMET2000)

④ in any case 无论如何,相当于whatever happens. 如:

You should finish your composition before school is over in any case. 无论如何,你必须在放学前完成作文。

In any case, I'll come over to the office tomorrow. 无论如何,我明天会来办公室的。

⑤ in no case决不,置于句首时,须用倒装语序。如:

In no case shall we allow smoking in the classroom. 教室里决对不允许吸烟。

In no case shall you break the rule. 你决不能违反纪律。

⑥ such being the case 既然如此,情况既然是这样

Such being the case, I have no more to say. 既然如此,我再无话可说。 Such being the case, we were very lucky to have a house of our own.

既然如此,我们能有一幢自己的房子就算很幸运了。

2. case作名词还有以下一些常见的意义:

There is a beautiful jewel case on the desk. (盒子)

This is a case of fever. (病例)

There are five cases of flu among the staff. (病人;患者) When will the case come before the Court? (案件)

二、 case作动词,是及物动词,意为"将……装入箱子"。如:

The goods have been cased up for transport. 货物已装箱待运。 另外,be cased over with 则是"在……上另加一层物质"。如: The copper was cased over with silver. 铜上镀着银。

The brick wall is cased over with cement. 砖墙上涂了一层水泥。


第二篇:switch-case语句用法


switch-case语句用法

2007-12-25 08:11

if语句处理两个分支,处理多个分支时需使用if-else-if结构,但如果分支较多,则嵌套的if语句层就越多,程序不但庞大而且理解也比较困难.因此,C语言又提供了一个专门用于处理多分支结构的条件选择语句,称为switch语句,又称开关语句.使用switch语句直接处理多个分支(当然包括两个分支).其一般形式为:

引用

-------------------------------------------------------------------------------- switch(表达式)

{

case 常量表达式1:

语句1;

break;

case 常量表达式2:

语句2;

break;

……

case 常量表达式n:

语句n;

break;

default:

语句n+1;

break;

}

--------------------------------------------------------------------------------

switch语句的执行流程是:首先计算switch后面圆括号中表达式的值,然后用此值依次与各个case的常量表达式比较,若圆括号中表达式的值与某个case后面的常量表达式的值相等,就执行此case后面的语句,执行后遇break语句就退出switch语句;若圆括号中表达式的值与所有case后面的常量表达式都不等,则执行default后面的语句n+1,然后退出switch语句,程序流程转向开关语句的下一个语句.如下程序,可以根据输入的考试成绩的等级,输出百分制分数段:

引用

-------------------------------------------------------------------------------- switch(grade)

{

case 'A': /*注意,这里是冒号:并不是分号;*/

printf("85-100\n");

break; /*每一个case语句后都要跟一个break用来退出switch语句*/

case 'B': /*每一个case后的常量表达式必须是不同的值以保证分支的唯一性*/ printf("70-84\n");

break;

case 'C':

printf("60-69\n");

break;

case 'D':

printf("<60\n");

break;

default:

printf("error!\n");

}

--------------------------------------------------------------------------------

(2) 如果在case后面包含多条执行语句时,也不需要像if语句那样加大括号,进入某个case后,会自动顺序执行本case后面的所有执行语句.如:

引用

-------------------------------------------------------------------------------- {

case 'A':

if(grade<=100)

printf("85-100\n");

else

printf("error\n");

break;

……

--------------------------------------------------------------------------------

(3) default总是放在最后,这时default后不需要break语句.并且,default部分也不是必须的,如果没有这一部分,当switch后面圆括号中表达式的值与所有case后面的常量表达式的值都不相等时,则不执行任何一个分支直接退出switch语句.此时,switch语句相当于一个空语句.例如,将上面例子中switch语句中的default部分去掉,则当输入的字符不是"A","B","C"或"D"时,此switch语句中的任何一条语句也不被执行.

(4) 在switch-case语句中,多个case可以共用一条执行语句,如:

引用

-------------------------------------------------------------------------------- ……

case 'A':

case 'B':

case 'c':

printf(">60\n");

break;

……

--------------------------------------------------------------------------------

在A,B,C3种情况下,均执行相同的语句,即输出">60".

(5) 最开始那个例子中,如果把每个case后的break删除掉,则当greak='A'时,程序从printf("85-100\n")开始执行,输出结果为:

引用

-------------------------------------------------------------------------------- 85-100

70-84

60-69

<60

error

--------------------------------------------------------------------------------

这是因为case后面的常量表达式实际上只起语句标号作用,而不起条件判断作用,即"只是开始执行处的入口标号".因此,一旦与switch后面圆括号中表达式的值匹配,就从此标号处开始执行,而且执行完一个case后面的语句后,若没遇到break语句,就自动进入下一个case继续执行,而不在判断是否与之匹配,直到遇到break语句才停止执行,退出break语句.因此,若想执行一个case分之后立即跳出switch语句,就必须在此分支的最后添加一个break语句.

引用

-------------------------------------------------------------------------------- main() /*完成两个数简单的四则运算*/

{

float a,b;

char c1;

printf("Please enter a,b and op:");

scanf("%f%c%f",&a,&c1,&b);

switch(c1)

{

case '+':

printf("%f+%f=%f\n",a,b,a+b);

break;

case '-':

printf("%f-%f=%f\n",a,b,a-b); break;

case '*':

printf("%f*%f=%f\n",a,b,a*b); break;

case '/':

if(b!=0.0) /*分母不能等于0*/ printf("%f/%f=%f\n",a,b,a/b); else

printf("error!\n");

break;

default:

printf("error!\n");

break;

}

}

更多相关推荐:
托福写作练习Cause and effect

1019CauseandeffectMusicisoneofthebestwaystoexpressemotionsandthoughtsBecauseofthespecialstructurenotonlyourhumanmou...

英语写作cause and effect essay

AreIPRsnecessaryforthedevelopmentofChinaChinahasmadetrademarklawpatentlawandcopyrightlawonebyonesincethe19xxsTheleg...

Cause and effect 范文

Causeandeffect范文ObesityhasbecomeamajorproblemintheUAEUnitedArabEmiratesOver60ofEmiratinationals酋长国国民areov...

英语cause and effect写作范文

SugarcoattheMediaSensationalizedReportingTheWinnersofNobelPrizeHaveBeenAnnouncePubliclyLiuDehuaHasBeenMarriedForMan...

Cause and effect作文

Chen1IpledgethatthispaperwaswrittenwithoutanyunauthorizedassistanceandIneitherstolenorcheatedduringthewritingproces...

cause and effect sample

Thetwostrategicpointsyouhavetoconsiderare1whetheryou39reexploringcausesoreffectsorbothand2whatistheorderofthecauses...

Cause and Effect

NameSimonClassC20xx105128NowadaysmoreandmoreChinesestudentsstudyabroadandthensettledownratherthangohomewhichcausest...

sample for a cause-effect essay

ThefollowingsampledemonstratetheprocessesthemultiplecausesinvolvedinasingleeventFranksonsrisetopowerNoticethatthere...

Education Pays范文

EducationPaysTheabovebarchartclearlyshowsuseducationpaysin20xxWeseethatunemploymentrateofthosewithhighere...

Education Pays-英语范文

EducationPays的几例范文范文一Asisshownabovethebarchartclearlydemonstratestherelationshipbetweentheeducationlevela...

(大学英语四级作文)Education pays

EducationpaysAsthebarchartshowstheweeklyearningsin20xxwerediminishingstrictlyfromdoctoraldegreetohighschooldiplomaa...

Education Pays四级作文

EducationPaysTheabovebarchartclearlyshowsuseducationpaysin20xxWeseethatunemploymentrateofthosewithhighereducationba...

cause and effect(9篇)