Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Sherzod5048
Sherzod5048

Posted on

C++ da Switch case 'Tanlash operatori'

Switch case asosan bir nechta qiymatdan, o'zgaruvchiga mos qiymatni tanlashda va qiymatga mos ravishda boshqarishni amalga oshirishda ishlatilinadi:
Switch case operatorini sintaksisi quyidagi tartibda yoziladi:
Masala 1:

Kiritgan sonimizga mos ravishda hafta kunini chiqaruvchi programma tuzilsin.

#include<iostream>usingnamespacestd;intmain(){intn;cin>>n;switch(n){case1:cout<<"Dushanba";break;case2:cout<<"Seshanba";break;case3:cout<<"Chorshanba";break;case4:cout<<"Payshanba";break;case5:cout<<"Juma";break;case6:cout<<"Shanba";break;case7:cout<<"Yakshanba";break;default:cout<<"Bunday hafta kuni yuq";}return0;}
Enter fullscreen modeExit fullscreen mode
1Dushanba
Enter fullscreen modeExit fullscreen mode

Biz kiritgan son(n)case dagi qiymatga (1) tengligi uchuncase 1: da berilgan ma'lumotni consolega chiqardi.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Sherzod Jumayev
  • Joined

More fromSherzod5048

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp