Logo

dev-resources.site

for different kinds of informations.

switch

Published at
11/2/2024
Categories
cpp
coding
programming
beginners
Author
Sanjar Rashidov
Categories
4 categories in total
cpp
open
coding
open
programming
open
beginners
open
switch

Switch - o'zgaruvchini tekshirish uchun foydalaniladi.

Switchda faqatgina "int" va "char" dan foydalana olamiz.

Masalan:

#include <iostream>

using namespace std;

int main()
{
    int n;

    cin >> n;

    switch (day) 
    {
        case 7:
        cout << "I like it" << endl;
        break;
        case 77:
        cout << "I love it" << endl;
        break;
        case 777:
        cout << "I adore it" << endl;
        break;
        default:
        cout << "none" << endl;
    }

    return 0;
}

Featured ones: