DEV Community

Sanjar Rashidov
Sanjar Rashidov

Posted on

2 1 1 1 1

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;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay