{"id":9841,"date":"2023-10-06T23:19:05","date_gmt":"2023-10-06T23:19:05","guid":{"rendered":"https:\/\/adelnasim.com\/docs\/courses\/cpp-tutorial\/logical-operators\/"},"modified":"2024-04-07T01:19:22","modified_gmt":"2024-04-07T01:19:22","slug":"logical-operators","status":"publish","type":"docs","link":"https:\/\/adelnasim.com\/ar\/docs\/courses\/cpp-tutorial\/logical-operators\/","title":{"rendered":"\u0627\u0644\u0645\u0639\u0627\u0645\u0644\u0627\u062a \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629"},"content":{"rendered":"<div class=\"logo-gutter ng-tns-c3907565777-124 ng-star-inserted\">\n<div class=\"resize-observable\"><\/div>\n<\/div>\n<div class=\"response-container-content ng-tns-c3907565777-124\">\n<div class=\"response-content ng-trigger ng-trigger-responsePopulation ng-tns-c3907565777-124\">\n<div class=\"markdown markdown-main-panel\" dir=\"ltr\">\n<p data-sourcepos=\"1:1-1:137\">\u062a\u064f\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0641\u064a \u0644\u063a\u0629 C++ \u0644\u062f\u0645\u062c \u0623\u0648 \u062a\u0639\u062f\u064a\u0644 \u0627\u0644\u062a\u0639\u0628\u064a\u0631\u0627\u062a \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629. \u0625\u0646\u0647\u0627 \u062a\u0633\u0645\u062d \u0644\u0643 \u0628\u0625\u0646\u0634\u0627\u0621 \u0639\u0628\u0627\u0631\u0627\u062a \u0634\u0631\u0637\u064a\u0629 \u0623\u0643\u062b\u0631 \u062a\u0639\u0642\u064a\u062f\u064b\u0627.<\/p>\n<p data-sourcepos=\"3:1-3:39\">\u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0627\u0644\u062b\u0644\u0627\u062b\u0629 \u0641\u064a C++ \u0647\u064a:<\/p>\n<ul data-sourcepos=\"5:1-8:0\">\n<li data-sourcepos=\"5:1-5:99\"><strong>And (&amp;&amp;)<\/strong>: \u062a\u0643\u0648\u0646 \u0646\u062a\u064a\u062c\u062a\u0647 \u0635\u062d\u064a\u062d\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0643\u0644\u0627 \u0627\u0644\u0645\u0639\u0627\u0645\u0644\u064a\u0646 \u0635\u062d\u064a\u062d\u064a\u0646. \u0648\u0625\u0644\u0627 \u0641\u0625\u0646\u0647\u0627 \u062a\u0631\u062c\u0639 \u0646\u062a\u064a\u062c\u0629 \u062e\u0627\u0637\u0626\u0629.<\/li>\n<li data-sourcepos=\"6:1-6:91\"><strong>Or (||)<\/strong>: \u062a\u0643\u0648\u0646 \u0646\u062a\u064a\u062c\u062a\u0647 \u0635\u062d\u064a\u062d\u0629 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0623\u062d\u062f \u0627\u0644\u0645\u0639\u0627\u0645\u0644\u064a\u0646 \u0635\u062d\u064a\u062d. \u0648\u0625\u0644\u0627 \u0641\u0625\u0646\u0647\u0627 \u062a\u0631\u062c\u0639 \u0646\u062a\u064a\u062c\u0629 \u062e\u0627\u0637\u0626\u0629.<\/li>\n<li data-sourcepos=\"7:1-8:0\"><strong>Not (!)<\/strong>: \u064a\u0646\u0641\u064a \u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0639\u0627\u0645\u0644 \u0627\u0644\u062e\u0627\u0635 \u0628\u0647. \u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0645\u0639\u0627\u0645\u0644 \u0635\u062d\u064a\u062d\u064b\u0627\u060c \u0641\u0625\u0646\u0647 \u064a\u064f\u0631\u062c\u0639 \u062e\u0637\u0623. \u0648\u0625\u0644\u0627 \u0641\u0625\u0646\u0647 \u064a\u0639\u0648\u062f \u0635\u062d\u064a\u062d\u0627.<\/li>\n<\/ul>\n<p data-sourcepos=\"9:1-9:189\">\u064a\u0645\u0643\u0646 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0644\u0625\u0646\u0634\u0627\u0621 \u0639\u0628\u0627\u0631\u0627\u062a \u0634\u0631\u0637\u064a\u0629 \u0623\u0643\u062b\u0631 \u062a\u0639\u0642\u064a\u062f\u064b\u0627. \u0639\u0644\u0649 \u0633\u0628\u064a\u0644 \u0627\u0644\u0645\u062b\u0627\u0644\u060c \u064a\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0627\u0644\u062a\u0627\u0644\u064a \u0627\u0644\u0645\u0639\u0627\u0645\u0644 AND <code>&amp;&amp;<\/code> \u0644\u0644\u062a\u062d\u0642\u0642 \u0645\u0645\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0631\u0642\u0645 \u0645\u0648\u062c\u0648\u062f\u064b\u0627 \u0641\u064a \u0646\u0637\u0627\u0642 \u0645\u0639\u064a\u0646 \u0645\u0646 \u0627\u0644\u0623\u0631\u0642\u0627\u0645 \u0623\u0645 \u0644\u0627:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block\">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    int x = 0;\r\n    cout &lt;&lt; \"Enter a number\";\r\n    cin &gt;&gt; x;\r\n    if (x &gt;= 1 &amp;&amp; x &lt;= 100)\r\n        cout &lt;&lt; \"Ok\" &lt;&lt; endl;\r\n    else\r\n        cout &lt;&lt; \"Out of range\" &lt;&lt; endl;\r\n\r\n    return 0;\r\n}<\/pre>\n<\/div>\n<p data-sourcepos=\"9:1-9:189\">\u0645\u062b\u0627\u0644 \u0625\u0636\u0627\u0641\u064a:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block\">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    int a = 0;\r\n    cout &lt;&lt; \"Enter your age\";\r\n    cin &gt;&gt; a;\r\n    char g = '\\0';\r\n    cout &lt;&lt; \"Enter your gender\";\r\n    cin &gt;&gt; g;\r\n    \r\n    if (a &lt; 18 &amp;&amp; g == 'm')\r\n        cout &lt;&lt; \"male, \" &lt;&lt; \"young boy\" &lt;&lt; endl;\r\n    else if (a &gt;= 18 &amp;&amp; g == 'm')\r\n        cout &lt;&lt; \"male,\" &lt;&lt; \"grown up man\" &lt;&lt; endl;\r\n    else if (a &lt; 18 &amp;&amp; g == 'f')\r\n        cout &lt;&lt; \"female,\" &lt;&lt; \"young girl\" &lt;&lt; endl;\r\n    else\r\n        cout &lt;&lt; \"female,\" &lt;&lt; \"grown up girl\" &lt;&lt; endl;\r\n    \r\n    return 0;\r\n}<\/pre>\n<\/div>\n<p data-sourcepos=\"9:1-9:189\"><strong>\u0645\u0644\u0627\u062d\u0638\u0629: <code>\\0<\/code> \u0641\u064a \u0644\u063a\u0629 C++ \u064a\u0643\u0648\u0646 \u0642\u064a\u0645\u0629\u064b \u0641\u0627\u0631\u063a\u0629 NULL. \u0625\u0646\u0647 \u0642\u064a\u0645\u0629 \u062a\u0645 \u0636\u0628\u0637 \u062c\u0645\u064a\u0639 \u0627\u0644\u0628\u062a\u0627\u062a bits \u0641\u064a\u0647\u0627 \u0639\u0644\u0649 \u0627\u0644\u0635\u0641\u0631. \u064a\u062a\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645\u0647 \u0644\u0648\u0636\u0639 \u0639\u0644\u0627\u0645\u0629 \u0639\u0644\u0649 \u0646\u0647\u0627\u064a\u0629 \u0627\u0644\u0646\u0635 \u0641\u064a C++.<\/strong><\/p>\n<p data-sourcepos=\"25:1-25:97\">\u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0627\u0644\u062a\u0627\u0644\u064a \u064a\u0633\u062a\u062e\u062f\u0645 \u0645\u0639\u0627\u0645\u0644 <code>||<\/code> \u0644\u0644\u062a\u062d\u0642\u0642 \u0645\u0645\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0631\u0642\u0645 \u0623\u0643\u0628\u0631 \u0645\u0646 10 \u0623\u0648 \u0623\u0642\u0644 \u0645\u0646 5:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block\">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    int number = 3;\r\n\r\n    if (number &gt; 10 || number &lt; 5) \r\n        cout &lt;&lt; \"The number is greater than 10 or less than 5.\" &lt;&lt; endl;\r\n    \r\n    return 0;\r\n}<\/pre>\n<\/div>\n<p data-sourcepos=\"41:1-41:101\">\u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0627\u0644\u062a\u0627\u0644\u064a \u064a\u0633\u062a\u062e\u062f\u0645 \u0645\u0639\u0627\u0645\u0644 <code>!<\/code> \u0644\u0646\u0641\u064a \u0642\u064a\u0645\u0629 \u0627\u0644\u062a\u0639\u0628\u064a\u0631 \u0627\u0644\u0645\u0646\u0637\u0642\u064a <code>number &gt; 10<\/code>:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block\">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">#include &lt;iostream&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    int number = 3;\r\n\r\n    if (! (number &gt; 10)) \r\n        cout &lt;&lt; \"The number is not greater than 10.\" &lt;&lt; endl;\r\n    \r\n    return 0;\r\n}<\/pre>\n<\/div>\n<p data-sourcepos=\"57:1-57:181\">\u064a\u0645\u0643\u0646 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0644\u0625\u0646\u0634\u0627\u0621 \u0639\u0628\u0627\u0631\u0627\u062a \u0634\u0631\u0637\u064a\u0629 \u0645\u0639\u0642\u062f\u0629 \u0644\u0644\u063a\u0627\u064a\u0629. \u0648\u0645\u0639 \u0630\u0644\u0643\u060c \u0645\u0646 \u0627\u0644\u0645\u0647\u0645 \u0627\u0633\u062a\u062e\u062f\u0627\u0645\u0647\u0627 \u0628\u0639\u0646\u0627\u064a\u0629 \u0644\u062a\u062c\u0646\u0628 \u062c\u0639\u0644 \u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0635\u0639\u0628 \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0648\u0627\u0644\u0635\u064a\u0627\u0646\u0629.<\/p>\n<p data-sourcepos=\"59:1-59:56\">\u0641\u064a\u0645\u0627 \u064a\u0644\u064a \u0628\u0639\u0636 \u0627\u0644\u0642\u0648\u0627\u0639\u062f \u0627\u0644\u0639\u0627\u0645\u0629 \u0644\u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629:<\/p>\n<ul data-sourcepos=\"61:1-66:0\">\n<li data-sourcepos=\"61:1-61:109\">\u064a\u0645\u0643\u0646 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0644\u062f\u0645\u062c \u0627\u0644\u062a\u0639\u0628\u064a\u0631\u0627\u062a \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0644\u0625\u0646\u0634\u0627\u0621 \u0639\u0628\u0627\u0631\u0627\u062a \u0634\u0631\u0637\u064a\u0629 \u0623\u0643\u062b\u0631 \u062a\u0639\u0642\u064a\u062f\u064b\u0627.<\/li>\n<li data-sourcepos=\"62:1-62:103\">\u0627\u0644\u0640\u00a0<code>&amp;&amp;<\/code>\u00a0\u064a\u064f\u0631\u062c\u0639 \u0635\u062d\u064a\u062d\u064b\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0643\u0644\u0627 \u0627\u0644\u0645\u0639\u0627\u0645\u0644\u064a\u0646 \u0635\u062d\u064a\u062d\u064a\u0646. \u0648\u0625\u0644\u0627 \u0641\u0625\u0646\u0647\u0627 \u062a\u0631\u062c\u0639 \u0642\u064a\u0645\u0629 \u062e\u0627\u0637\u0626\u0629.<\/li>\n<li data-sourcepos=\"63:1-63:96\">\u0627\u0644\u0640\u00a0<code>||<\/code>\u00a0\u064a\u064f\u0631\u062c\u0639 \u0635\u062d\u064a\u062d\u064b\u0627 \u0625\u0630\u0627 \u0643\u0627\u0646 \u0623\u062d\u062f \u0627\u0644\u0645\u0639\u0627\u0645\u0644\u064a\u0646 \u0635\u062d\u064a\u062d \u0627\u0644\u0642\u064a\u0645\u0629. \u0648\u0625\u0644\u0627 \u0641\u0625\u0646\u0647 \u064a\u0631\u062c\u0639 \u0642\u064a\u0645\u0629 \u062e\u0627\u0637\u0626\u0629.<\/li>\n<li data-sourcepos=\"64:1-64:122\">\u0627\u0644\u0640\u00a0<code>!<\/code>\u00a0\u064a\u0646\u0641\u064a \u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0639\u0627\u0645\u0644 \u0627\u0644\u062e\u0627\u0635 \u0628\u0647. \u0625\u0630\u0627 \u0643\u0627\u0646 \u0627\u0644\u0645\u0639\u0627\u0645\u0644 \u0635\u062d\u064a\u062d\u064b\u0627\u060c \u0641\u0625\u0646\u0647 \u064a\u064f\u0631\u062c\u0639 \u062e\u0637\u0623. \u0648\u0625\u0644\u0627 \u0641\u0625\u0646\u0647 \u064a\u0639\u0648\u062f \u0635\u062d\u064a\u062d\u0627.<\/li>\n<li data-sourcepos=\"65:1-66:0\">\u064a\u0645\u0643\u0646 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629 \u0641\u064a \u0627\u0644\u062a\u0639\u0628\u064a\u0631\u0627\u062a \u0627\u0644\u0645\u062a\u062f\u0627\u062e\u0644\u0629.<\/li>\n<\/ul>\n<p data-sourcepos=\"67:1-67:98\">\u0645\u0646 \u062e\u0644\u0627\u0644 \u0641\u0647\u0645 \u0643\u064a\u0641\u064a\u0629 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0639\u0648\u0627\u0645\u0644 \u0627\u0644\u0645\u0646\u0637\u0642\u064a\u0629\u060c \u064a\u0645\u0643\u0646\u0643 \u0643\u062a\u0627\u0628\u0629 \u0643\u0648\u062f C++ \u0623\u0643\u062b\u0631 \u0643\u0641\u0627\u0621\u0629 \u0648\u0645\u0648\u062b\u0648\u0642\u064a\u0629.<\/p>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Logical operators in C++ are used to combine or modify Boolean expressions. They allow you to create more complex conditional statements. The three logical operators in C++ are: And (&amp;&amp;): Returns true if both of its operands are true. Otherwise, it returns false. Or (||): Returns true if either of its operands is true. Otherwise, [&hellip;]<\/p>","protected":false},"author":3,"featured_media":0,"parent":2744,"menu_order":11,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-9841","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/9841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/comments?post=9841"}],"version-history":[{"count":6,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/9841\/revisions"}],"predecessor-version":[{"id":10559,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/9841\/revisions\/10559"}],"up":[{"embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/docs\/2744"}],"wp:attachment":[{"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/media?parent=9841"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/adelnasim.com\/ar\/wp-json\/wp\/v2\/doc_tag?post=9841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}