日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

小程序 || 语句_C ++条件语句| 查找输出程序| 套装1

發布時間:2025/3/11 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 小程序 || 语句_C ++条件语句| 查找输出程序| 套装1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

小程序 || 語句

Program 1:

程序1:

#include <iostream> using namespace std;int main() {if (NULL) {cout << "Hello World";}else {cout << "Hii World";}return 0; }

Output:

輸出:

Hii World

Explanation:

說明:

The program will print "Hii World" on the console screen. Because the value of NULL is 0, then the if statement will be false and the else part will be executed.

該程序將在控制臺屏幕上打印“ Hii World” 。 因為NULL的值為0 ,所以if語句將為false并將執行else部分。

Program 2:

程式2:

#include <iostream> using namespace std;int main() {int A = 5, B = 10, C = 20;if (A && B > C) {cout << "ABC";}else if (A = B || C == 20) {cout << "PQR";}else {cout << "XYZ";}return 0; }

Output:

輸出:

PQR

Explanation:

說明:

Execute the program step by step:

逐步執行程序:

int A=5, B=10, C=20;if(A&&B>C)if(5&&10>20)According to operator priority table, greater than (>) operator will evaluate before the logical and (&&) thenif(5&&0)if(0) Then, program's execution will jump to,else if(A=B || C==20)According to the operator priority table, equal to (==) operator will be evaluated before the assignment and logical or operatorelse if(10 || 20)else if(1)Here, condition is true and its block will be executed,Then the final output will be "PQR".

Program 3:

程式3:

#include <iostream> using namespace std;int main() {int A = 15, B = 10, C = 20;if (A > B) {if (A >= 15) {if (C > 10 ? A > 5 ? NULL : 1 : 2) {cout << "111";}else {cout << "222";}}else {cout << "333";}}else {cout << "444";}return 0; }

Output:

輸出:

222

Explanation:

說明:

Execute the program step by step:

逐步執行程序:

int A=15, B=10, C=20;if( A>B) that is if(15>10) condition is true thenif(A>=15) that is if(15>=15) condition is true thenNow checking,if(C>10 ? A>5 ? NULL : 1 : 2) Here, C>10 that is 20>10 condition is true then check A>5 that is 15>5 condition is again true then it returns NULL, and the value of NULL is 0 and then if statement will be false. Then the else part will be executed and will print "222" on the console screen.

Recommended posts

推薦的帖子

  • C++ Conditional Statements | Find output programs | Set 2

    C ++條件語句| 查找輸出程序| 套裝2

  • C++ Reference Variable| Find output programs | Set 1

    C ++參考變量| 查找輸出程序| 套裝1

  • C++ Reference Variable| Find output programs | Set 2

    C ++參考變量| 查找輸出程序| 套裝2

  • C++ const Keyword | Find output programs | Set 1

    C ++ const關鍵字| 查找輸出程序| 套裝1

  • C++ const Keyword | Find output programs | Set 2

    C ++ const關鍵字| 查找輸出程序| 套裝2

  • C++ Operators | Find output programs | Set 1

    C ++運算符| 查找輸出程序| 套裝1

  • C++ Operators | Find output programs | Set 2

    C ++運算符| 查找輸出程序| 套裝2

  • C++ Switch Statement | Find output programs | Set 1

    C ++轉換語句| 查找輸出程序| 套裝1

  • C++ Switch Statement | Find output programs | Set 2

    C ++轉換語句| 查找輸出程序| 套裝2

  • C++ goto Statement | Find output programs | Set 1

    C ++ goto語句| 查找輸出程序| 套裝1

  • C++ goto Statement | Find output programs | Set 2

    C ++ goto語句| 查找輸出程序| 套裝2

  • C++ Looping | Find output programs | Set 1

    C ++循環| 查找輸出程序| 套裝1

  • C++ Looping | Find output programs | Set 2

    C ++循環| 查找輸出程序| 套裝2

  • C++ Looping | Find output programs | Set 3

    C ++循環| 查找輸出程序| 套裝3

  • C++ Looping | Find output programs | Set 4

    C ++循環| 查找輸出程序| 套裝4

  • C++ Looping | Find output programs | Set 5

    C ++循環| 查找輸出程序| 套裝5

翻譯自: https://www.includehelp.com/cpp-tutorial/conditional-statements-find-output-programs-set-1.aspx

小程序 || 語句

總結

以上是生活随笔為你收集整理的小程序 || 语句_C ++条件语句| 查找输出程序| 套装1的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。