Search Blog

Saturday, April 9, 2022

How To Use Switch Case ?

             Here We Will Learn To Program C. I'll try To give my Best To Make you understand.


                                                                         "Let's Begin"

A Programme to Get Grade Brief 
Using Switch Case

Syntax:-switch(Variable or Name)
{
                           case '1st Value': 
                            work to done
                  break;
                          case '1st Value':
                           work to done
                  break;
                         case '1st Value':
                            work to done
                   break; 
           default:
                            work to done
}
SWITCH CASE is A Beautiful Thing in c.It is Very Useful.In This The Varible Is Taken And Value of  it Checked By Different case.We Can add Infinite Cases.And A Default is Taken if the value isn't matches for Any Cases The Default work Is done

In this Programme "a" is Taken From user.Here "a" is Grade of The user(Recommended from A-F).
Their Are 6 Cases(A-F) With Different work. For Ex:- If User Entered A Then Case 1 i.e. Case 'A':
 Will run And EXCELENT Will Be printed. This Thing Will Happen for all The Cases.
Default :  If The Value Doesn't Matches For All The Cases Then Default will Run.
break; is Used to Stop The Running programme Hence it says "Switch Your Work Is Done HAha".

OUTPUTS 




Download Link Of Above Programme:-

How to Use it.
Download File >Go To Turboc3(or turboc folder)>bin>Paste File>
open Turbo c Application>File>open(or F3)>Select File
 
NOTE:- Above File Can Be Opened With Other Compilers(Like code blocks, visual studio, etc.), Some Changes Might Require.

 THANKS

No comments:

Post a Comment

How to Add Two Array(or Matrix) ?

    Here We Will Learn To Program C. I'll try To give my Best To Make you understand.                                                   ...