C++ : Switch (Advance ) in hindi , what is Switch at advanced level in c++ language with example program

what is Switch at advanced level in c++ language with example program , C++ : Switch (Advance ) in hindi :-
इससे पहले के article मे , switch statement को discuss किया जाता है | जिसमे multiple conditions को check किया जाता है | जैसे switch statement मे case label को use किया जाता ही | case lable मे switch statement मो pass किया गया expression या condition से प्राप्त आउटपुट के आधार पर अलग अलग block को perform किया जाता है |}switch statement के लिए उदाहर निन्म है :
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char choice ;
cout<<“Enter ‘m’ for morning  “;
cout<<“Enter ‘a’ for afternoon”;
cout<<“Enter ‘n’ for night “;
cout<<“Enter Choice  : “;
cin>>choice ;
switch(choice)
{
case ‘m’ :
cout<<“Good morning ! Have a nice day .”;
break;
case ‘a’ :
cout<<“Good afternoon ! Make sure half day of this day will be go fine.”;
break;
case ‘n’ :
cout<<“Good night ! Sweet Dreams.”;
break;
defalut :
cout<<“Invalid Choice “;
break;
}
cout<<“Output : “<<c;
getch();
}
getch();
}
इस उदाहरन मे , यूजर द्वारा choice को input किया जाता है | जिसे variable choice मे assign कर दिया जाता है | अगर यूजर द्वारा input किये गये input  निन्म होते है
अगर ‘m’ होती है तब morning message display होगा |
अगर ‘a’ होती है तब afternoon message display होगा |
अगर ‘n’ होती है तब night message display होगा |Enumeration as switch case lable
किसी enum variable के value को switch statement के case lable को declare किया जाता है | enum value एक constant की तरह करता है जिसकी कोई constant value होती है | उदाहरन के लिए :
enum{red,yellow,blue ,green};
इस enum variable मे चार values होती है | जिसमे red की value ‘0’ होती है | और yellow की value ‘1’ होती है | और blue की value ‘2’ होती है | और green की value ‘3’ होती है |
जब switch statement मे enum की value को pass किया जाता है तब इसके constant value के साथ डील किया जाता है |
उदाहरन के लिए :

#include<iostream.h>
#include<conio.h>
enum {parrot,peacock, dove, piegoen , crow , sparrow };
void main()
{
using namespace std;
int choice ;
cout<<“Enter Choice  (0-6) : “;
cin>>choice ;
while(choice >= parrot && choice <= sparrow)
{
switch(choice)
{
case sparrow  :
cout<<“Your Bird is sparrow.”;
break;
case peacock  :
cout<<“Your Bird is peacock.”;
break;
case dove  :
cout<<“Your Bird is dove.”;
break;
case piegoen  :
cout<<“Your Bird is piegoen.”;
break;
case crow  :
cout<<“Your Bird is crow.”;
break;
case parrot  :
cout<<“Your Bird is parrot.”;
break;
defalut :
cout<<“Sorry , We can not arrange your bird “;
break;
}
}
getch();
}
इस उदाहरन मे , enum बर्ड को use किया जाट अहै | जिसमे छ प्रकार के birds को use किया जाता है | यह पर parrot=0,peacock=1, dove=2, piegoen=3 , crow=4, sparrow=5 होती है | while loop मे , यूजर द्वारा input की गयी choice को enum value parrot और स्पैरो से check करते है | choice का data type integer है इसलिए यह पर choice की value ‘0’ से बड़ी और ‘5’ से कम होती है |
switch statement मे choice को pass किया जाता है |
अगर यूजर द्वारा input की गयी value ‘1’ होगी तब peacock को display किया जाता है |
अगर यूजर द्वारा input की गयी value ‘2’ होगी तब dove को display किया जाता है |
अगर यूजर द्वारा input की गयी value ‘3’ होगी तब piegoen को display किया जाता है |
अगर यूजर द्वारा input की गयी value ‘4’ होगी तब crow को display किया जाता है |
अगर यूजर द्वारा input की गयी value ‘5’ होगी तब sparrow को display किया जाता है |

break और continue statement
break और continue statement  का use प्रोग्राम के किसी block को स्किप करने के लिए किया जाता है | इसके अलावा break statement का use switch statement मे भी use किया जाता है | और loop मे भी किया जा सकता है |
अगर loop मे  break statement use किया जाता है तब  loop का control,loop से बहार हो जाता है |
ओए अगर switch मे break statement को use किया जाता है तब switch statement का control switch statement से बहार चला जाता है |
और break और continue statement  से loop के किसी भाग  को स्किप किया जा सकता है |
break statement ; इस statement से कंट्रो को स्किप किया जाता है | इसके बाद के सभी statement को exwcution को स्किप किया जा सकता है | जब  तक  continue statement नहीं आ जाता है |
continue statement ; इस statement का use break statement को terminate करने के लिए किया जाता है |
इसका उदाहरन निन्म है :

#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
char name[50] ;
int place =0;
cout<<“line :”;
cin.get(name , 50);
cout<<“Full Name :”<<name;
cout<< ” Last Name : “;
for(int i =0 ; name [i]!=’\0′ ; i++)
{
cout<<name[i];
if(line[i]== “.”)
break;
if(name[i]!= ‘ ‘)
ccontiue;
place++;
}
coput<<“Place at :”<<place ;
getch();
}
इस उदाहरन  मे ,
सबसे पहले नाम को input किया जाता है | जिसमे first name और last name के बीच ‘.’ से separate किया जाता है |
इसके बाद फुल name को display किया जाता है | बाद last name को display किया जाता है |
last name को ‘.’ के बाद print करते है |

इस article मे , switch statement मे enum value को use को  और  break और continue statement  को discuss किया जाता है |