Nested if
Alisher Maxamadjonov
Posted on November 2, 2024
If da shart bo'lishda assignment operator ishlatish mumkin emas.
If statement dan keyin semicolon nuqtali vergul ishlatib bo'lmaydi.
Nested if - ichma ich if (nested if) dasturlashda ko'proq murakkab shartlarni, tekshirish va qarorlar qabul qilishda ishlatiladi bu shuni anglatadiki bir shart bajarilgandan keyin, yana bir shartni tekshirish zarur bo'lganda ichma ich iflardan foydalaniladi.
Nested if dan hosil bo'lgan else, if bir marta shartlarni tekshirishda ishlatiladi.
#include <iostream>
using namespace std;
int main()
{
int number;
cout << "Enter an integer: ";
cin >> number;
if (number > 0)
{
cout << "You entered a positive integer: " << number << endl;
}
cout << "This statement is always executed.";
return 0;
}
💖 💪 🙅 🚩
Alisher Maxamadjonov
Posted on November 2, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024