c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇_第1頁(yè)
c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇_第2頁(yè)
c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇_第3頁(yè)
c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇_第4頁(yè)
c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇_第5頁(yè)
已閱讀5頁(yè),還剩6頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、編號(hào):時(shí)間:20XX年X月X日X X 文 案頁(yè)碼:第 頁(yè)c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇 C語(yǔ)言中if語(yǔ)句基本的有三種格式,在此基礎(chǔ)上可以擴(kuò)展一些其它格式,下面我們來(lái)看看c語(yǔ)言if語(yǔ)句的用法。這次帥氣的我為您整理了c語(yǔ)言if語(yǔ)句的用法優(yōu)秀4篇,在大家參照的同時(shí),也可以分享一下給您最好的朋友。 if函數(shù)的使用方法 篇一 IF函數(shù)介紹 IF函數(shù)一般是指Excel中的IF函數(shù),根據(jù)指定的條件來(lái)判斷其“真”(TRUE)、“假”(FALSE),根據(jù)邏輯計(jì)算的真假值,從而返回相應(yīng)的內(nèi)容。 可以使用函數(shù) IF 對(duì)數(shù)值和公式進(jìn)行條件檢測(cè)。 IF函數(shù)的語(yǔ)法 IF(logical_test,value_if_true

2、,value_if_false) Logical_test 表示計(jì)算結(jié)果為 TRUE 或 FALSE 的任意值或表達(dá)式。 例如,A10=100 就是一個(gè)邏輯表達(dá)式,如果單元格 A10 中的值等于 100,表達(dá)式即為 TRUE,否則為 FALSE。 本參數(shù)可使用任何比較運(yùn)算符(一個(gè)標(biāo)記或符號(hào),指定表達(dá)式內(nèi)執(zhí)行的計(jì)算的類(lèi)型。 有數(shù)學(xué)、比較、邏輯和引用運(yùn)算符等。)。 Value_if_true logical_test 為 TRUE 時(shí)返回的值。 例如,如果本參數(shù)為文本字符串“預(yù)算內(nèi)”而且 logical_test 參數(shù)值為 TRUE,則 IF 函數(shù)將顯示文本“預(yù)算內(nèi)”。 如果 logical_te

3、st 為 TRUE 而 value_if_true 為空,則本參數(shù)返回 0(零)。 如果要顯示 TRUE,則請(qǐng)為本參數(shù)使用邏輯值 TRUE。 value_if_true 也可以是其他公式。 Value_if_false logical_test 為 FALSE 時(shí)返回的值。 例如,如果本參數(shù)為文本字符串“超出預(yù)算”而且 logical_test 參數(shù)值為 FALSE,則 IF 函數(shù)將顯示文本“超出預(yù)算”。 如果 logical_test 為 FALSE 且忽略了 value_if_false(即 value_if_true 后沒(méi)有逗號(hào)),則會(huì)返回邏輯值 FALSE。 如果 logical_te

4、st 為 FALSE 且 value_if_false 為空(即 value_if_true 后有逗號(hào),并緊跟著右括號(hào)),則本參數(shù)返回 0(零)。 VALUE_if_false 也可以是其他公式。 if引導(dǎo)的非真實(shí)條件句 篇二 對(duì)過(guò)去的虛擬 條件從句(if):主語(yǔ)+had done 主句might/would/should/could+have done 對(duì)現(xiàn)在的虛擬 if+ 主語(yǔ)+動(dòng)詞過(guò)去式(be用were)主句 might/would/should/could+do 對(duì)將來(lái)的虛擬 if+主語(yǔ)+動(dòng)詞過(guò)去式(be用were)或主語(yǔ)+should do或主語(yǔ)+were to do 主句 migh

5、t/would/should/could+do e.g. Tom got to the station in time because he started earlier. If Tom had started late, he would have missed the train. Do you think the thief entered through the door? No, if he had, I dont believe, he would have broken the living room window. If the book werent so expensiv

6、e, I would buy it. If you didnt live so far away, we would be able to visit you more. What would you do if you lost your passport in a foreign country? Why hasnt he come? If he should not come on time, we would have to put off the trip. 2、注意事項(xiàng) e.g. If she hadnt work hard at English in the past, she

7、wouldnt work as well as a secretary in a large company now. 混合時(shí)間的虛擬語(yǔ)氣 從句為對(duì)過(guò)去的虛擬,主句是現(xiàn)在。 Had we not used an outofdate timetable, we wouldnt have missed the train. if引導(dǎo)從句的倒裝從句相當(dāng)于 if we had not used an outofdate timetable, 同樣,were還有should 在從句中都可以提前,省略if. If only 要是。.。就好了 If only I were younger! If only

8、I had worked harder in my teenage years! If only I should travel tomorrow! 虛擬語(yǔ)氣的十大句型 篇三 一、虛擬條件句: 條件狀語(yǔ)從句是非真實(shí)情況,在這種情況下要用虛擬語(yǔ)氣。 1、條件從句與現(xiàn)在事實(shí)不一致,其句型為: 句型1:If +主語(yǔ)+過(guò)去時(shí),主語(yǔ)+ should (could, would, 或might) +動(dòng)詞原形 (1) If I were you, I would study hard. (2) If it rained, I would not be here now. 2、條件從句與過(guò)去事實(shí)不一致,其句型

9、為: 句型2:If +主語(yǔ)+had+過(guò)去分詞,主語(yǔ)+ should(could, would, 或might)+ have +過(guò)去分詞 (3) If the doctor had come last night, the boy would have been saved. (4) If I had not studied hard, I would have failed in the exam last term. 3、條件從句與將來(lái)事實(shí)不一致,其句型為: 句型3:If +主語(yǔ)+過(guò)去時(shí)/ should +動(dòng)詞原形/ were to+動(dòng)詞原形,主語(yǔ)+ should (could, would

10、, 或might) +動(dòng)詞原形 (5) If it should rain tomorrow, we would stay at home. (6) If I were to go to the moon one day, I could see it with my own eyes. (7) If you missed the film tonight, you would feel sorry. 注意問(wèn)題: 1.If條件句中絕對(duì)不可以出現(xiàn)would。 2、根據(jù)句中的時(shí)間狀語(yǔ),有時(shí)可能出現(xiàn)混合虛擬的情況,即主句可能是現(xiàn)在的情況,條件句也許是發(fā)生在過(guò)去的情況,但都要遵守上述句型。如: (8)

11、 If you had studied hard before, you would be a college student now and you would graduate from a college in four years time. 3、條件句中如果出現(xiàn)were, had, should可省去if,將主語(yǔ)與這些詞倒裝。例如: (9) Had the doctor come last night, the boy would have been saved. (10) Were I to go to the moon one day, I would see it with m

12、y own eyes. (11) Should it rain tomorrow, we would stay at home. 二、名詞性虛擬語(yǔ)氣: 在表示命令、建議、要求、驚嘆時(shí)的名詞性從句中需用虛擬語(yǔ)氣,基本句型: 句型4:主語(yǔ)+(should)+動(dòng)詞原形 (12) Mother insisted that John (should) go to bed at 9 oclock.(賓語(yǔ)從句) (13) It was required that the crops (should) be harvested at once.(主語(yǔ)從句) (14) It is surprising that

13、 she shouldnt pass the math exam. (主語(yǔ)從句) (15) The suggestion that he (should) be invited was rejected.(同位語(yǔ)從句) (16) Their demand is that their wages (should) be increased.(表語(yǔ)從句) 注意:在這種句子中絕不可以出現(xiàn)would, must, could等。 三、虛擬語(yǔ)氣在一些特殊詞中的使用或含蓄條件句: 句型5:wish后的賓語(yǔ)從句 與現(xiàn)在愿望不一致:主語(yǔ)+過(guò)去時(shí); 與過(guò)去愿望不一致:主語(yǔ)+ had +過(guò)去分詞 / could

14、+ have +過(guò)去分詞; 與未來(lái)愿望不一致:主語(yǔ)+ would / could +動(dòng)詞原形。如; (17) I wish I were you. (18) I wish I had visited the White House when I was in the States. (19) I wish I could meet you tomorrow at the party. 句型6:Its time句型(當(dāng)Its time后用that從句時(shí)應(yīng)該為主語(yǔ)+ should +動(dòng)詞原形或主語(yǔ)+過(guò)去時(shí)) (20) Its time that you went / should go to sc

15、hool. 句型7:If only引起的感嘆句相當(dāng)于How I wish +賓語(yǔ)從句 (21) If only he could come! 他要能來(lái)就好了。 (22) If only I had known the answer! 我要早知答案就好了。 句型8:would rather, as if(though)引導(dǎo)的句子也需使用虛擬,表示過(guò)去的情況用過(guò)去完成時(shí),表示現(xiàn)在與將來(lái)的情況 用過(guò)去時(shí)。 (23) Id rather you posted the letter right away. (24) Id rather you had returned the book yesterda

16、y. (25) She loves the children as if they were hers. (26) Alan talked about Rome as if he had been there. 句型9:without, but, but for, but that, otherwise引起的短語(yǔ)或句子常暗含著虛擬條件。 (27) Without you, I would never know him. (28) But for your cooperation, we wouldnt have done the work so well. (29) But that she

17、was afraid, she would have said no. (30) I would be most glad to help you, but I am busy now. (31) I should have come to the party yesterday, but I was busy. (32) I am busy now; otherwise I would do you the favor! 句型10:If it were not for 。.。 / If it hadnt been for 。.。 (要不是因?yàn)椋?,其后面的主句也需使用虛擬。 (33) If i

18、t were not for his help, I wouldnt go home now. (34) If it hadnt been for the determined captain, all the passengers on the board wouldnt have been saved. If引導(dǎo)的條件狀語(yǔ)從句用法 篇四 1.if引導(dǎo)的條件狀語(yǔ)從句可以放在主句之前,也可以放在主句之后,如果放在主句之前,中間要用逗號(hào)將主句和從句隔開(kāi)。 例如: If I am free, I will come to see you. = I will come to see you if I am free. 如果我有空,我就來(lái)看你。 2、 在含if引導(dǎo)的條件狀語(yǔ)從句的復(fù)合句中,主句用一般將來(lái)時(shí),從句通常用一般現(xiàn)在時(shí)態(tài)表示將來(lái)意義,即主將

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論