{"id":14510,"date":"2025-04-16T21:39:53","date_gmt":"2025-04-16T14:39:53","guid":{"rendered":"https:\/\/www.krujeen.com\/?p=14510"},"modified":"2025-04-16T22:01:27","modified_gmt":"2025-04-16T15:01:27","slug":"%e0%b8%84%e0%b8%b3%e0%b8%aa%e0%b8%b1%e0%b9%88%e0%b8%87-if-%e0%b9%81%e0%b8%a5%e0%b8%b0%e0%b8%a3%e0%b8%b9%e0%b8%9b%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89","status":"publish","type":"post","link":"https:\/\/www.krujeen.com\/?p=14510","title":{"rendered":"\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07 if \u0e43\u0e19 C++"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/www.krujeen.com\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-16-2025-09_58_20-PM-1024x683.png\" alt=\"\" class=\"wp-image-14525\" srcset=\"https:\/\/www.krujeen.com\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-16-2025-09_58_20-PM-1024x683.png 1024w, https:\/\/www.krujeen.com\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-16-2025-09_58_20-PM-300x200.png 300w, https:\/\/www.krujeen.com\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-16-2025-09_58_20-PM-768x512.png 768w, https:\/\/www.krujeen.com\/wp-content\/uploads\/2025\/04\/ChatGPT-Image-Apr-16-2025-09_58_20-PM.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. if \u0e1e\u0e37\u0e49\u0e19\u0e10\u0e32\u0e19<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02) {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp line-numbers\">int x = 10;\nif (x &gt; 5) {\n    std::cout &lt;&lt; \"x \u0e21\u0e32\u0e01\u0e01\u0e27\u0e48\u0e32 5\" &lt;&lt; std::endl;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. if-else<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02) {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n} else {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e40\u0e1b\u0e47\u0e19\u0e40\u0e17\u0e47\u0e08\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp line-numbers\">int age = 18;\nif (age &gt;= 18) {\n    cout &lt;&lt; \"\u0e04\u0e38\u0e13\u0e40\u0e1b\u0e47\u0e19\u0e1c\u0e39\u0e49\u0e43\u0e2b\u0e0d\u0e48\" &lt;&lt; endl;\n} else {\n    cout &lt;&lt; \"\u0e04\u0e38\u0e13\u0e40\u0e1b\u0e47\u0e19\u0e40\u0e22\u0e32\u0e27\u0e0a\u0e19\" &lt;&lt; endl;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. if-else if-else<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e021) {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e021 \u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n} else if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e022) {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e022 \u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n} else if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e023) {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e023 \u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n} else {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e44\u0e21\u0e48\u0e21\u0e35\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e43\u0e14\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp line-numbers\">int score = 75;\nif (score &gt;= 80) {\n    cout &lt;&lt; \"\u0e40\u0e01\u0e23\u0e14 A\" &lt;&lt; endl;\n} else if (score &gt;= 70) {\n    cout &lt;&lt; \"\u0e40\u0e01\u0e23\u0e14 B\" &lt;&lt; endl;\n} else if (score &gt;= 60) {\n    cout &lt;&lt; \"\u0e40\u0e01\u0e23\u0e14 C\" &lt;&lt; endl;\n} else {\n    cout &lt;&lt; \"\u0e40\u0e01\u0e23\u0e14 F\" &lt;&lt; endl;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. Nested if (if \u0e0b\u0e49\u0e2d\u0e19 if)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e021) {\n    if (\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e022) {\n        \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e17\u0e31\u0e49\u0e07\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e021 \u0e41\u0e25\u0e30 \u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e022 \u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07\n    } else {\n        \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e021 \u0e40\u0e1b\u0e47\u0e19\u0e08\u0e23\u0e34\u0e07 \u0e41\u0e15\u0e48\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e022 \u0e40\u0e1b\u0e47\u0e19\u0e40\u0e17\u0e47\u0e08\n    }\n} else {\n    \/\/ \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e17\u0e35\u0e48\u0e08\u0e30\u0e17\u0e33\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e021 \u0e40\u0e1b\u0e47\u0e19\u0e40\u0e17\u0e47\u0e08\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp line-numbers\">int x = 10, y = 5;\nif (x &gt; 0) {\n    if (y &gt; 0) {\n        cout &lt;&lt; \"x \u0e41\u0e25\u0e30 y \u0e40\u0e1b\u0e47\u0e19\u0e1a\u0e27\u0e01\" &lt;&lt; endl;\n    } else {\n        cout &lt;&lt; \"x \u0e40\u0e1b\u0e47\u0e19\u0e1a\u0e27\u0e01 \u0e41\u0e15\u0e48 y \u0e44\u0e21\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e1a\u0e27\u0e01\" &lt;&lt; endl;\n    }\n} else {\n    cout &lt;&lt; \"x \u0e44\u0e21\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e1a\u0e27\u0e01\" &lt;&lt; endl;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>5. \u0e15\u0e31\u0e27\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02 (Conditional Operator)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">(\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02) ? \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e08\u0e23\u0e34\u0e07 : \u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e40\u0e17\u0e47\u0e08;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp line-numbers\">int x = 10;\nstring result = (x &gt; 5) ? \"\u0e21\u0e32\u0e01\u0e01\u0e27\u0e48\u0e32 5\" : \"\u0e19\u0e49\u0e2d\u0e22\u0e01\u0e27\u0e48\u0e32\u0e2b\u0e23\u0e37\u0e2d\u0e40\u0e17\u0e48\u0e32\u0e01\u0e31\u0e1a 5\";\ncout &lt;&lt; result &lt;&lt; endl;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e2b\u0e15\u0e38:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e43\u0e19 if \u0e04\u0e27\u0e23\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e27\u0e07\u0e40\u0e25\u0e47\u0e1a ()<\/li>\n\n\n\n<li>\u0e16\u0e49\u0e32\u0e21\u0e35\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e40\u0e14\u0e35\u0e22\u0e27 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e25\u0e30\u0e27\u0e07\u0e40\u0e25\u0e47\u0e1a\u0e1b\u0e35\u0e01\u0e01\u0e32 {} \u0e44\u0e14\u0e49<\/li>\n\n\n\n<li>\u0e23\u0e30\u0e27\u0e31\u0e07\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49 = \u0e41\u0e17\u0e19 == \u0e43\u0e19\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02 (= \u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e04\u0e48\u0e32, == \u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e23\u0e35\u0e22\u0e1a\u0e40\u0e17\u0e35\u0e22\u0e1a)<\/li>\n\n\n\n<li>\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49 &amp;&amp; (\u0e41\u0e25\u0e30), || (\u0e2b\u0e23\u0e37\u0e2d), ! (\u0e44\u0e21\u0e48) \u0e43\u0e19\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e40\u0e07\u0e37\u0e48\u0e2d\u0e19\u0e44\u0e02\u0e17\u0e35\u0e48\u0e0b\u0e31\u0e1a\u0e0b\u0e49\u0e2d\u0e19\u0e02\u0e36\u0e49\u0e19<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. if \u0e1e\u0e37\u0e49\u0e19\u0e10\u0e32\u0e19 \u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07: 2. if-else \u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07: 3. if-else [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":14525,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[155,156],"tags":[160],"class_list":["post-14510","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programing","category-c_language","tag-c"],"_links":{"self":[{"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/posts\/14510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=14510"}],"version-history":[{"count":6,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/posts\/14510\/revisions"}],"predecessor-version":[{"id":14527,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/posts\/14510\/revisions\/14527"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=\/wp\/v2\/media\/14525"}],"wp:attachment":[{"href":"https:\/\/www.krujeen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.krujeen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}