Skip to player
Skip to main content
Search
Connect
Watch fullscreen
Like
Bookmark
Share
More
Add to Playlist
Report
Learn Programming Technique C to Master Skills - Switch Case Program ( Use of Integer Value)
Tutorials Arena
Follow
1 year ago
Category
📚
Learning
Transcript
Display full video transcript
00:00
Hi, today I'm going to explain switch statement.
00:07
When in a program we have to take multiple times decision then we use if statement to
00:14
create the program.
00:16
When decision is to be taken number of times then number of if statement increases and
00:22
because of this it become difficult to read the program.
00:27
So what the developer did, they came up with the switch statement and it become simple
00:39
to make the program of multiple decision, so developer came up with the switch statement
00:45
to make multiple decision program simple.
00:50
The switch statement has the value of a given variable against the list of case values and
00:56
when match is found a block of statement associated with that case is executed.
01:04
I'm going to make one of the program one of the demo program of use of integer value and
01:12
I'm going to also make a demo program how to use the character value of switch case
01:19
The things will be more clear to all of you.
01:23
So I'm going to open a new file, empty file let us save it, so it's a simple program just
01:43
to demonstrate that how the switch case is used.
01:51
First thing what I will do I will use a variable a okay, now here I will give a message that
02:01
enter any value okay, so I will input any value I will use the scanner for it plus and
02:15
d comma and then what a, now here I will use the switch case, switch and inside it what
02:26
a, first of all I will use what case one and here I will display what one of the message
02:37
welcome inside it and at the end I will use the break statement then what case two, here
02:48
I will display a message how are you okay and I will apply the break statement then
03:00
what case three and what printf, one more message inside it, it's not mandatory only
03:13
that you have to you can use messages inside the test cases or you can inside the switch
03:20
cases but you can do the logical work by using the statement and you can apply the loop also
03:28
inside it okay, so we'll see in our further videos, coming videos we are going to use
03:36
the if statement for loop inside the switch cases okay.
03:41
Now I will use a default case and inside it I will use what a message that is what
03:54
by and here I will use rotate and zero for the exit status, so this is the switch case
04:04
program I hope everything is fine, let me run the program and then I will explain how
04:12
the value is going to the switch and then it will take you to a particular label to
04:19
the case okay, let us click on the build it's showing me zero error and the zero warning
04:25
I'm going to run it, suppose here I've used what input value three so scanf is going to
04:31
read it, so what the switch case is going to do, what this switch case is going to do
04:36
as it is having the value three, it will directly take me to this case three okay to this label
04:44
and what it should display, it should display what come again, so let me press the enter
04:50
so displayed what come again okay, now let us run one more time and if I input any other
04:57
value suppose seven so there is not any case seven but there is a default case so it will
05:03
take to the default case and what is there inside the default case that is by okay, so
05:14
what it should display by when I press enter it displayed by, break statement is used to
05:22
break from the particular case okay, the next program which I will going to explain that how
05:30
to use the character value, thanks
Be the first to comment
Add your comment
Recommended
2:44
|
Up next
Learn Programming Technique C to Master Skills - Switch Case Program ( Use of Character Value)
Tutorials Arena
1 year ago
3:28
Learn Programming Technique C to Master Skills - Switch Case Program ( Continue ...)
Tutorials Arena
1 year ago
7:56
Learn Programming Technique C to Master Skills - Nested If Statement Program
Tutorials Arena
1 year ago
7:22
Learn Programming Technique C to Master Skills - Tenth Program of Function (Use of Different Datatypes)
Tutorials Arena
1 year ago
2:34
Learn Programming Technique C to Master Skills - Second Program of Function ( Return Val) - I
Tutorials Arena
1 year ago
4:54
Learn Programming Technique C to Master Skills - Single If Statement Program (Flow Chart)
Tutorials Arena
1 year ago
2:58
Learn Programming Technique C to Master Skills - Nested If Statement Program (Flow Chart)
Tutorials Arena
1 year ago
12:06
Learn Programming Technique C to Master Skills - Continuous If Statement Program
Tutorials Arena
1 year ago
7:12
Learn Programming Technique C to Master Skills - Third Program (Passing Entire Array in Function)
Tutorials Arena
1 year ago
5:14
Learn Programming Technique C to Master Skills - Single If Statement Program Explanation
Tutorials Arena
1 year ago
6:04
Learn Programming Technique C to Master Skills - First Program (Array with Function , Call by Value)
Tutorials Arena
1 year ago
10:56
Learn Programming Technique C to Master Skills - Loop With If Statement Program
Tutorials Arena
1 year ago
3:16
Learn Programming Technique C to Master Skills - First Program of Function ( Continue ...)
Tutorials Arena
1 year ago
4:57
Learn Programming Technique C to Master Skills - Loop With If Statement Program ( Flow Chart )
Tutorials Arena
1 year ago
9:09
Learn Programming Technique C to Master Skills - Second Program( Call by Reference)
Tutorials Arena
1 year ago
2:02
Learn Programming Technique C to Master Skills - Use of & sign with variables
Tutorials Arena
1 year ago
7:02
Learn Programming Technique C to Master Skills - Sixth Program of Array (Loop with if)
Tutorials Arena
1 year ago
5:29
Learn Programming Technique C to Master Skills - Continuous If Program (Flow Chart)
Tutorials Arena
1 year ago
6:33
Learn Programming Technique C to Master Skills - Multiple Selection Program
Tutorials Arena
1 year ago
3:40
Learn Programming Technique C to Master Skills - Array of Pointer Program
Tutorials Arena
1 year ago
12:25
Learn Programming Technique C to Master Skills - Call By Reference Program
Tutorials Arena
1 year ago
3:37
Learn Programming Technique C to Master Skills - Pointers And Arrays Program ( Continue...)
Tutorials Arena
1 year ago
4:17
Learn Programming Technique C to Master Skills - Linked List ( Create Node Program)
Tutorials Arena
1 year ago
4:22
Learn Programming Technique C to Master Skills - Pointer And Arrays Program
Tutorials Arena
1 year ago
6:03
Learn Programming Technique C to Master Skills - Linked List ( Second Program)
Tutorials Arena
1 year ago
Be the first to comment