Switch

#include<iostream>

using namespace std;



int main()

{


//program starts




         int alpha;


         int digit;


//menu


         cout<<"Press 1 For Alphabet!!"<<endl;


         cout<<"Press 2 For Number!!"<<endl;


      switch(choice)


  {


  case 1;


  if(alpha>='a' && alpha<='z')

  {


  cout<<alpha<<"It is an alpha!!!";


  }

  case 2;


  else if(digit>='1' && digit>='10')


  {


  cout<<digit<<"it is an digit!!!";

  }

  default:

  cout<<"Wrong value!!!";

  return 0;


}   


}







//6thProgram

//7thProgram


#include<iostream>

using namespace std;


int main()

{

//program starts

char alpha;

cout<<"Enter Alphabets!!"<<endl;

cin>>alpha;

//switch statment sart

switch(alpha)

{

case 'a':

cout<<"It's Vowel\n";

break;

case 'e':

cout<<"It's Vowel\n";

break;

case 'i':

cout<<"It's Vowel\n";

break;

case 'o':

cout<<"It's Vowel\n";

break;

case 'u':

cout<<"It's Vowel\n";

break;

default:

cout<<"it's Not Vowel!!";

return 0;

Comments