版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(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 文 案頁碼:第 頁c語言if語句的用法優(yōu)秀4篇 C語言中if語句基本的有三種格式,在此基礎(chǔ)上可以擴(kuò)展一些其它格式,下面我們來看看c語言if語句的用法。這次帥氣的我為您整理了c語言if語句的用法優(yōu)秀4篇,在大家參照的同時(shí),也可以分享一下給您最好的朋友。 if函數(shù)的使用方法 篇一 IF函數(shù)介紹 IF函數(shù)一般是指Excel中的IF函數(shù),根據(jù)指定的條件來判斷其“真”(TRUE)、“假”(FALSE),根據(jù)邏輯計(jì)算的真假值,從而返回相應(yīng)的內(nèi)容。 可以使用函數(shù) IF 對(duì)數(shù)值和公式進(jìn)行條件檢測(cè)。 IF函數(shù)的語法 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ì)算的類型。 有數(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 后沒有逗號(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ì)過去的虛擬 條件從句(if):主語+had done 主句might/would/should/could+have done 對(duì)現(xiàn)在的虛擬 if+ 主語+動(dòng)詞過去式(be用were)主句 might/would/should/could+do 對(duì)將來的虛擬 if+主語+動(dòng)詞過去式(be用were)或主語+should do或主語+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í)間的虛擬語氣 從句為對(duì)過去的虛擬,主句是現(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! 虛擬語氣的十大句型 篇三 一、虛擬條件句: 條件狀語從句是非真實(shí)情況,在這種情況下要用虛擬語氣。 1、條件從句與現(xiàn)在事實(shí)不一致,其句型為: 句型1:If +主語+過去時(shí),主語+ 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、條件從句與過去事實(shí)不一致,其句型
9、為: 句型2:If +主語+had+過去分詞,主語+ should(could, would, 或might)+ have +過去分詞 (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、條件從句與將來事實(shí)不一致,其句型為: 句型3:If +主語+過去時(shí)/ should +動(dòng)詞原形/ were to+動(dòng)詞原形,主語+ 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. 注意問題: 1.If條件句中絕對(duì)不可以出現(xiàn)would。 2、根據(jù)句中的時(shí)間狀語,有時(shí)可能出現(xiàn)混合虛擬的情況,即主句可能是現(xiàn)在的情況,條件句也許是發(fā)生在過去的情況,但都要遵守上述句型。如: (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,將主語與這些詞倒裝。例如: (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. 二、名詞性虛擬語氣: 在表示命令、建議、要求、驚嘆時(shí)的名詞性從句中需用虛擬語氣,基本句型: 句型4:主語+(should)+動(dòng)詞原形 (12) Mother insisted that John (should) go to bed at 9 oclock.(賓語從句) (13) It was required that the crops (should) be harvested at once.(主語從句) (14) It is surprising that
13、 she shouldnt pass the math exam. (主語從句) (15) The suggestion that he (should) be invited was rejected.(同位語從句) (16) Their demand is that their wages (should) be increased.(表語從句) 注意:在這種句子中絕不可以出現(xiàn)would, must, could等。 三、虛擬語氣在一些特殊詞中的使用或含蓄條件句: 句型5:wish后的賓語從句 與現(xiàn)在愿望不一致:主語+過去時(shí); 與過去愿望不一致:主語+ had +過去分詞 / could
14、+ have +過去分詞; 與未來愿望不一致:主語+ 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)該為主語+ should +動(dòng)詞原形或主語+過去時(shí)) (20) Its time that you went / should go to sc
15、hool. 句型7:If only引起的感嘆句相當(dāng)于How I wish +賓語從句 (21) If only he could come! 他要能來就好了。 (22) If only I had known the answer! 我要早知答案就好了。 句型8:would rather, as if(though)引導(dǎo)的句子也需使用虛擬,表示過去的情況用過去完成時(shí),表示現(xiàn)在與將來的情況 用過去時(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引起的短語或句子常暗含著虛擬條件。 (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)的條件狀語從句用法 篇四 1.if引導(dǎo)的條件狀語從句可以放在主句之前,也可以放在主句之后,如果放在主句之前,中間要用逗號(hào)將主句和從句隔開。 例如: If I am free, I will come to see you. = I will come to see you if I am free. 如果我有空,我就來看你。 2、 在含if引導(dǎo)的條件狀語從句的復(fù)合句中,主句用一般將來時(shí),從句通常用一般現(xiàn)在時(shí)態(tài)表示將來意義,即主將
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 小數(shù)點(diǎn)位置移動(dòng)引起小數(shù)大小的變化課件
- 新生兒氣道管理課件
- 焊接工藝課件-焊條電弧焊V形坡口板對(duì)接橫焊
- 《慢阻肺gold指南》課件
- 《草帽圖解析話術(shù)》課件
- 《心理學(xué)章》課件
- 【課件】發(fā)現(xiàn)你的優(yōu)勢(shì)
- 【大學(xué)課件】建筑電氣安裝工程定額計(jì)價(jià)
- 單位管理制度展示匯編【人力資源管理】
- 單位管理制度展示大全職工管理篇
- 無錫市區(qū)2024-2025學(xué)年四年級(jí)上學(xué)期數(shù)學(xué)期末試題一(有答案)
- GB/T 45014-2024聚合物基復(fù)合材料層壓板緊固件拉脫阻抗試驗(yàn)方法
- 傳播學(xué)(東北林業(yè)大學(xué))知到智慧樹章節(jié)答案
- 2024年安全員之A證考試題庫及完整答案(網(wǎng)校專用)
- 血液凈化中心院內(nèi)感染控制課件
- 統(tǒng)編版2024-2025學(xué)年三年級(jí)上冊(cè)語文期末情景測(cè)試卷 (無答案)
- 年產(chǎn)1.5萬噸長(zhǎng)鏈二元酸工程建設(shè)項(xiàng)目可研報(bào)告
- 績(jī)效考核辦法1
- 【MOOC】外科護(hù)理學(xué)-中山大學(xué) 中國(guó)大學(xué)慕課MOOC答案
- 年度學(xué)校辦公室工作總結(jié)
- 2025版國(guó)家開放大學(xué)法律事務(wù)??啤睹穹▽W(xué)(2)》期末紙質(zhì)考試總題庫
評(píng)論
0/150
提交評(píng)論