




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、編號:時間:20XX年X月X日X X 文 案頁碼:第 頁c語言if語句的用法優(yōu)秀4篇 C語言中if語句基本的有三種格式,在此基礎(chǔ)上可以擴展一些其它格式,下面我們來看看c語言if語句的用法。這次帥氣的我為您整理了c語言if語句的用法優(yōu)秀4篇,在大家參照的同時,也可以分享一下給您最好的朋友。 if函數(shù)的使用方法 篇一 IF函數(shù)介紹 IF函數(shù)一般是指Excel中的IF函數(shù),根據(jù)指定的條件來判斷其“真”(TRUE)、“假”(FALSE),根據(jù)邏輯計算的真假值,從而返回相應(yīng)的內(nèi)容。 可以使用函數(shù) IF 對數(shù)值和公式進行條件檢測。 IF函數(shù)的語法 IF(logical_test,value_if_true
2、,value_if_false) Logical_test 表示計算結(jié)果為 TRUE 或 FALSE 的任意值或表達式。 例如,A10=100 就是一個邏輯表達式,如果單元格 A10 中的值等于 100,表達式即為 TRUE,否則為 FALSE。 本參數(shù)可使用任何比較運算符(一個標記或符號,指定表達式內(nèi)執(zhí)行的計算的類型。 有數(shù)學、比較、邏輯和引用運算符等。)。 Value_if_true logical_test 為 TRUE 時返回的值。 例如,如果本參數(shù)為文本字符串“預算內(nèi)”而且 logical_test 參數(shù)值為 TRUE,則 IF 函數(shù)將顯示文本“預算內(nèi)”。 如果 logical_te
3、st 為 TRUE 而 value_if_true 為空,則本參數(shù)返回 0(零)。 如果要顯示 TRUE,則請為本參數(shù)使用邏輯值 TRUE。 value_if_true 也可以是其他公式。 Value_if_false logical_test 為 FALSE 時返回的值。 例如,如果本參數(shù)為文本字符串“超出預算”而且 logical_test 參數(shù)值為 FALSE,則 IF 函數(shù)將顯示文本“超出預算”。 如果 logical_test 為 FALSE 且忽略了 value_if_false(即 value_if_true 后沒有逗號),則會返回邏輯值 FALSE。 如果 logical_te
4、st 為 FALSE 且 value_if_false 為空(即 value_if_true 后有逗號,并緊跟著右括號),則本參數(shù)返回 0(零)。 VALUE_if_false 也可以是其他公式。 if引導的非真實條件句 篇二 對過去的虛擬 條件從句(if):主語+had done 主句might/would/should/could+have done 對現(xiàn)在的虛擬 if+ 主語+動詞過去式(be用were)主句 might/would/should/could+do 對將來的虛擬 if+主語+動詞過去式(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、注意事項 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. 混合時間的虛擬語氣 從句為對過去的虛擬,主句是現(xiàn)在。 Had we not used an outofdate timetable, we wouldnt have missed the train. if引導從句的倒裝從句相當于 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! 虛擬語氣的十大句型 篇三 一、虛擬條件句: 條件狀語從句是非真實情況,在這種情況下要用虛擬語氣。 1、條件從句與現(xiàn)在事實不一致,其句型為: 句型1:If +主語+過去時,主語+ should (could, would, 或might) +動詞原形 (1) If I were you, I would study hard. (2) If it rained, I would not be here now. 2、條件從句與過去事實不一致,其句型
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、條件從句與將來事實不一致,其句型為: 句型3:If +主語+過去時/ should +動詞原形/ were to+動詞原形,主語+ should (could, would
10、, 或might) +動詞原形 (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條件句中絕對不可以出現(xiàn)would。 2、根據(jù)句中的時間狀語,有時可能出現(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. 二、名詞性虛擬語氣: 在表示命令、建議、要求、驚嘆時的名詞性從句中需用虛擬語氣,基本句型: 句型4:主語+(should)+動詞原形 (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)在愿望不一致:主語+過去時; 與過去愿望不一致:主語+ had +過去分詞 / could
14、+ have +過去分詞; 與未來愿望不一致:主語+ would / could +動詞原形。如; (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句型(當Its time后用that從句時應(yīng)該為主語+ should +動詞原形或主語+過去時) (20) Its time that you went / should go to sc
15、hool. 句型7:If only引起的感嘆句相當于How I wish +賓語從句 (21) If only he could come! 他要能來就好了。 (22) If only I had known the answer! 我要早知答案就好了。 句型8:would rather, as if(though)引導的句子也需使用虛擬,表示過去的情況用過去完成時,表示現(xiàn)在與將來的情況 用過去時。 (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 。.。 (要不是因為),其后面的主句也需使用虛擬。 (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引導的條件狀語從句用法 篇四 1.if引導的條件狀語從句可以放在主句之前,也可以放在主句之后,如果放在主句之前,中間要用逗號將主句和從句隔開。 例如: If I am free, I will come to see you. = I will come to see you if I am free. 如果我有空,我就來看你。 2、 在含if引導的條件狀語從句的復合句中,主句用一般將來時,從句通常用一般現(xiàn)在時態(tài)表示將來意義,即主將
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 古代表示年齡的詞語從小到大排序
- 公益慈善存在的問題及建議
- 公共直飲水點管理制度
- 公共交通服務(wù)質(zhì)量評估制度
- 工作票安規(guī)流程
- 工業(yè)產(chǎn)品外觀設(shè)計的基本原則
- 2025年養(yǎng)老保險市場分析:參保人數(shù)穩(wěn)步增長 持續(xù)優(yōu)化服務(wù)保障
- 廣東省茂名市2024-2025學年高三上學期第一次綜合測試數(shù)學試題(解析版)
- 湛江降水井施工方案
- 寧波耐堿磚施工方案
- 中醫(yī)理療免責協(xié)議書
- 精神科病人安全與治療管理制度
- 廚房食材收貨流程
- 品牌服飾行業(yè)快速消費品庫存管理優(yōu)化方案
- 貝雷橋吊裝專項方案(危大工程吊裝方案)
- 昌江縣燕窩嶺水泥用石灰?guī)r礦礦產(chǎn)資源開發(fā)利用與保護方案
- 2024年《認證基礎(chǔ)》真題及答案
- ZHF形勢與政策(2024年秋)-考試題庫
- 淤地壩應(yīng)急處置
- 鸚鵡介紹課件教學課件
- 汽車檢測技術(shù)課件 任務(wù)一 認識汽車檢測站
評論
0/150
提交評論