Difference between revisions of "C-and-C++/C2/Nested-If-And-Switch-Statement/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with '{| border=1 || '''Time''' || '''Narration''' |- | 00:01 | Welcome to the spoken tutorial on Nested if & Switch statements in C and C++. |- | 00:08 | In this tutorial we wil…')
 
 
(8 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
|-
 
|-
 
|  00:01
 
|  00:01
| Welcome to the spoken tutorial on Nested if & Switch statements in C and C++.
+
| C અને C++ નેસ્ટેડ ઇફ અને સ્વિચ સ્ટેટમેન્ટ પરના સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
  
 
|-
 
|-
| 00:08
+
| 00:07
|   In this tutorial we will learn ,  
+
| આ ટ્યુટોરીયલમાં આપણે શીખીશું,
  
 
|-
 
|-
|  00:11
+
|  00:09
| How to use nested if statement. And
+
| નેસ્ટેડ ઇફ અને સ્વિચ સ્ટેટમેન્ટને
  
 
|-
 
|-
|  00:14
+
|  00:12
| switch statement.
+
|કેવી રીતે વાપરવું.
  
 
|-
 
|-
|  00:16
+
|  00:13
| We will do this with the help of an examples.
+
| આપણે આ કેટલાક ઉદાહરણોની મદદથી કરીશું.
  
 
|-
 
|-
|  00:20
+
|  00:17
| To record this tutorial, I am using,
+
| આ ટ્યુટોરીયલ રેકોર્ડ કરવા માટે હું વાપરી રહ્યી છું,
  
 
|-
 
|-
|  00:23
+
|  00:20
| Ubuntu operating system version 11.10
+
| ઉબુન્ટુ ઓપરેટીંગ સિસ્ટમ આવૃત્તિ 11.10
  
 
|-
 
|-
|  00:27
+
|  00:24
| gcc and g++ Compiler version 4.6.1 on Ubuntu.
+
|ઉબુન્ટુ ઉપર gcc અને g++ કમ્પાઈલર આવૃત્તિ 4.6.1.
  
 
|-
 
|-
| 00:34
+
| 00:30
|   First we will learn, how to write '''nested if and switch statement''' with an example.
+
| પ્રથમ આપણે, નેસ્ટેડ ઇફ અને સ્વિચ સ્ટેટમેન્ટને કેવી રીતે લખવું તે ઉદાહરણ સાથે શીખીશું.
  
 
|-
 
|-
|  00:42
+
|  00:36
| I have already written the program
+
| મેં પહેલાથી પ્રોગ્રામ લખ્યો છે.
  
 
|-
 
|-
| 00:44
+
| 00:39
| Let’s have a look
+
| ચાલો જોઈએ.
 +
 
 
|-
 
|-
|  00:49
+
|  00:40
| In this program ,we will learn to check the range of integers.
+
| આ પ્રોગ્રામમાં આપણે ઈન્ટીજર ની શ્રેણી તપાસવાનું શીખીશું.
 +
 
 
|-
 
|-
|  00:53
+
|  00:45
| Note that our file name is '''nested-if.c'''
+
| નોંધ લો કે આપણી ફાઈલનું નામ '''nested-if.c''' છે.
  
 
|-
 
|-
01:00
+
|  00:50
Let me explain the code now.
+
ચાલો હું હવે કોડ સમજાવું.
  
 
|-
 
|-
01:03
+
00:52
This is our Header file.
+
આ આપણી હેડર ફાઈલ છે.
 
+
  
 
|-
 
|-
01:05
+
00:54
This is our  main function.
+
આ આપણું મેઈન ફન્કશન છે.
 
   
 
   
 +
|-
 +
|  00:56
 +
| મેઈન ફન્કશન અંદર આપણે બે ઈન્ટીજર વેરિયેબલ જાહેર કર્યા છે, ''''x અને y''''.
  
 
|-
 
|-
| 01:07
+
|   01:02
| Inside the main function we have declared   two integer variable ''''x and y''''
+
|અહીં આપણે યુઝરને '''0 થી 39''' ની શ્રેણી વચ્ચે નંબર દાખલ કરવા માટે પ્રોમ્પ્ટ કરીએ છીએ.
  
 
|-
 
|-
|   01:16
+
| 01:08
|Here we prompt the users to enter a number between the range of''' 0 to 39'''.
+
| આપણે '''y''' ની વેલ્યુ યુઝર પાસેથી ઈનપુટ તરીકે લઈએ છીએ.
 +
 
 
|-
 
|-
| 01:23
+
| 01:12
| we take the value of '''y''' as input from the user.
+
| આ આપણી if કન્ડીશન છે.
  
 
|-
 
|-
| 01:30
+
|   01:14
| This is our if condition
+
| અહીં આપણે તપાસીશું કે y/10=0 છે કે નહી.
  
 
|-
 
|-
|   01:32
+
| 01:19
| Here, we will check whether y/10=0
+
| જો કન્ડીશન true હોય તો,
  
 
|-
 
|-
|  01:36
+
|  01:20
| If the condition is true
+
|આપણે પ્રિન્ટ કરીશું, '''"you have entered a number  in the range of 0-9.'''
  
 
|-
 
|-
| 01:38
+
| 01:25
| We print '''"you have entered a number  in the range of 0-9.'''
+
| આ આપણી else-if કન્ડીશન છે.
  
 
|-
 
|-
| 01:47
+
| 01:28
| This is our else-if condition.
+
| અહીં આપણે y/10=1 તપાસ કરીશું.
  
 
|-
 
|-
|  01:50
+
|  01:32
| Here we check that y/10=1.
+
|જો કન્ડીશન true હોય તો,
 +
 
 
|-
 
|-
|  01:54
+
|  01:34
|If the condition is true.
+
| આપણે પ્રિન્ટ કરીશું, '''you have entered a number in the range of 10-19.'''
  
 
|-
 
|-
| 01:56
+
|   01:39
| We print '''you have entered a number in the range of 10-19.'''
+
|આ else if કન્ડીશનમાં આપણે તપાસ કરીશું કે નમ્બર 20 થી 29 ની શ્રેણી વચ્ચે છે કે નહિ.
  
 
|-
 
|-
|  02:03
+
01:45
|In this else if condition we check whether the number is in the range of 20-29.
+
| અને અહીં આપણે જોઈશું કે નમ્બર 30 થી 39 ની શ્રેણી વચ્ચે છે કે નહિ.
|-
+
 
02:11
+
| And here we will see that the number is in the range of 30 to 39.
+
 
|-
 
|-
02:19
+
01:51
| This is our else condition.
+
|આ આપણી else કન્ડીશન છે.
 
+
  
 
|-
 
|-
02:21
+
01:53
| If all of the above conditions are false
+
|જો ઉપરની બધી કન્ડીશન false હોય તો,
  
 
|-
 
|-
02:24
+
01:55
| We print''' number not in range.'''
+
| આપણે પ્રિન્ટ કરીશું,''' number not in range.'''
  
 
|-
 
|-
02:28
+
01:58
| And this is our return statement
+
| અને આ આપણું રીટર્ન સ્ટેટમેન્ટ છે.
 +
 
 
|-
 
|-
|  02:31
+
|  02:01
| Now let us execute the program.
+
|હવે ચાલો પ્રોગ્રામ એકઝીક્યુટ કરીએ.
  
 
|-
 
|-
|    02:35
+
|    02:03
| Please open the terminal window , by pressing Ctrl+Alt+T keys simultaneously on your keyboard.
+
| તમારા કીબોર્ડ પર એકસાથે Ctrl + Alt + T દબાવીને, ટર્મિનલ વિન્ડો ખોલો.
  
 
|-
 
|-
| 02:45
+
| 02:12
|To  execute , Type “gcc” space “nested-if.c” space hyphen “-o” space “nested”.  Press '''Enter'''
+
|એકઝીક્યુટ કરવા માટે , ટાઇપ કરો, “gcc” સ્પેસ “nested-if.c” સ્પેસ હાયફન “-o” સ્પેસ “nested”.  એન્ટર ડબાઓ.
  
 
|-
 
|-
| 02:57
+
| 02:23
| type dot slash “./nested”. Press '''Enter'''
+
| ડોટ સ્લેશ “nested” ટાઇપ કરો. એન્ટર ડબાઓ.
  
 
|-
 
|-
03:01
+
02:28
| We see,Enter a number between 0 to 39.  
+
| આપણે જોઈશું,Enter a number between 0 to 39.  
  
 
|-
 
|-
| 03:06 
+
| 02:32
| I will  Enter '''12'''
+
|હું '''12''' દાખલ કરીશ.
  
 
|-
 
|-
| 03:09
+
| 02:34
| | The output is displayed as:
+
|આઉટપુટ આ પ્રમાણે દર્શાવે છે:
  
 
|-
 
|-
03:11
+
02:35
 
|''' you have entered the  number  in the range of 10-19'''.
 
|''' you have entered the  number  in the range of 10-19'''.
  
 
|-
 
|-
03:17
+
02:40
| Let us enter another number.
+
| ચાલો બીજો નમ્બર દાખલ કરીએ.
 +
 
 
|-
 
|-
03:21
+
02:42
|   Let's execute again. Press the up arrow key, press enter.
+
|ચાલો ફરીથી એક્ઝીક્યુટ કરીએ. અપ એરો કી ડબાઓ, એન્ટર ડબાઓ.
  
 
|-
 
|-
03:28
+
02:48
| I will give ''' 5''' this time.
+
| આ વખતે હું ''' 5''' આપીશ.
  
 
|-
 
|-
03:34
+
02:50
| We see the output as :
+
| આપણે આઉટપુટ આ પ્રમાણે જોઈશું :
  
 
|-
 
|-
03:35
+
02:52
 
|  you have entered the number  in the range of 0-9.
 
|  you have entered the number  in the range of 0-9.
 +
 
|-
 
|-
03:42
+
02:56
| The conditional execution can also be done in another way.
+
|કંડીશનલ એક્ઝેક્યુશન બીજી રીતે પણ કરી શકાય છે.
  
 
|-
 
|-
|  03:46
+
|  03:00
| By using '''switch statement. '''
+
| '''switch statement ''' ના ઉપયોગ દ્વારા.
  
 
|-
 
|-
|  03:49
+
|  03:02
| Let’s see how it is done.
+
| ચાલો જોઈએ એ કેવી રીતે કરવું.
  
 
|-
 
|-
| 03:51
+
| 03:05
| We will see  the same program using '''switch'''.
+
| આપણે સમાન પ્રોગ્રામ '''switch''' ના ઉપયોગ સાથે જોઈશું.
  
 
|-
 
|-
|  03:57
+
|  03:08
| I have already opened the program.
+
|મેં પહેલાથી પ્રોગ્રામ ખોલ્યો છે.
 
+
  
 
|-
 
|-
|  03:59
+
|  03:10
| Let's switch back to our text editor
+
| આપણા એડિટર પર પાછા જઈએ.
 +
 
 
|-
 
|-
04:07
+
03:13
|I have explained this in the previous program.     
+
|મેં આ અગાઉના પ્રોગ્રામ સમજાવ્યું છે.     
  
 
|-
 
|-
| 04:11
+
| 03:16
|So i will move on to the '''Switch statements'''
+
|તો હું '''Switch statements''' ઉપર જઈશ.
+
 
    
 
    
 
|-
 
|-
| 04:16
+
| 03:20
||Here, we divide the inputs i.e '''y'''   by 10 and the result  is  stored in  the variable '''x'''.
+
||અહીં, આપણે ઇનપુટ્સને વિભાજિત કરીશું, એટલે કે, '''y''' ભાગ્યા 10 અને પરિણામ '''x''' વેરિયેબલમાં સંગ્રહીશું.
  
 
|-
 
|-
|04:24  
+
|03:28  
| That means the quotient will be stored in x.
+
| એનો અર્થ એ થાય કે ભાગાકાર નું ફળ X માં સંગ્રહિત કરવામાં આવશે.
  
 
|-
 
|-
04:28
+
03:32
| With the help of the quotient we can identify the range of the number.
+
| આ ભાગાકાર ના ફળ ની મદદથી આપણે નંબર શ્રેણી ઓળખી શકીએ છીએ.
  
 
|-
 
|-
04:37
+
03:36
| Here, we tell the switch command that the variable to be checked is '''x'''.
+
| અહીં, આપણે સ્વીચ કમાન્ડને કહીએ છીએ કે ચેક કરવા માટેનો વેરિયેબલ '''x''' છે.  
  
 
|-
 
|-
04:47
+
03:41
|This is '''case 0''' . If case 0 is satisfied.
+
|'''case 0''' છે. જો case 0 બરાબર છે
  
 
|-
 
|-
04:50
+
03:45
| Then we print '''you have entered  the number in the range of0-9.'''
+
| તો આપણે પ્રિન્ટ કરીશું, '''you have entered  the number in the range of 0-9.'''
  
 
|-
 
|-
| 04:58
+
| 03:51
| We add '''break '''to come out of the loop if the case is satisfied.
+
|જો કેસ બરાબર હોય તો લૂપમાંથી બહાર નીકળવા માટે આપણે '''break''' ઉમેરીશું.
  
 
|-
 
|-
05:03
+
|  03:55
| We need to '''break '''the loop each time.  
+
| આપણે લુપને દરેક વખતે બ્રેક કરવું પડશે.
  
 
|-
 
|-
05:05
+
03:58
| It is because only one condition can be true at a time.
+
| કારણ કે, એક સમયે ફક્ત એક જ કન્ડીશન true હોઈ શકે.
  
 
|-
 
|-
| 05:11
+
| 04:03
|This is “case 1” . “case 1” means “if the value of '''x '''is 1”
+
|“case 1” છે. “case 1” એટલે કે “જો '''x ''' ની વેલ્યુ 1 હોય,
  
 
 
|-
 
|-
05:17
+
04:08
| We print '''you have entered a number in the range of 10-19.'''
+
|તો આપણે પ્રિન્ટ કરીશું, '''you have entered a number in the range of 10-19.'''
  
 
|-
 
|-
05:24
+
04:12
| This is  “case 2” .  
+
| “case 2” છે.  
  
 
|-
 
|-
05:26
+
04:14
|Here  we print '''you have entered a number in the range of 20-29.'''
+
|અહીં આપણે પ્રિન્ટ કરીશું, '''you have entered a number in the range of 20-29.'''
  
 
|-
 
|-
| 05:33
+
| 04:20
| And this is case 3. Here we check whether the number is in the range of 30-39.
+
|અને આ case 3 છે, અહીં આપણે તપાસ કરીશું કે નમ્બર  30-39 ની શ્રેણીમાં છે કે નહી.
 +
 
 
|-
 
|-
| 05:43
+
| 04:26
| This is the default case. Default case specifies what needs to be done if none of the above cases are satisfied.
+
| આ ડીફોલ્ટ કેસ છે. ડિફૉલ્ટ કેસ, ઉપરના કોઈ પણ કેસો બરાબર ન હોય તો શું કરવાની જરૂર છે તે સ્પષ્ટ કરે છે.
  
 
|-
 
|-
05:52
+
04:36
| Here we print number not in range.
+
|અહીં આપણે પ્રિન્ટ કરીશું, "number not in range"
  
 +
|-
 +
|  04:39
 +
|અને આ આપણું રીટર્ન સ્ટેટમેન્ટ છે.
  
 
|-
 
|-
05:57
+
04:41
| And This is our return statement.
+
| ચાલો પ્રોગ્રામ એક્ઝીક્યુટ કરીએ.
  
 
|-
 
|-
05:59
+
04:43
| Let us execute the program.
+
|ટર્મિનલ પર પાછા જઈએ.
  
 +
|-
 +
| 04:46
 +
|ટાઇપ કરો gcc space switch.c space -o space switch. એન્ટર ડબાઓ.
  
 
|-
 
|-
| 06:02
+
|04:55
|Switch back to the terminal.
+
| ટાઇપ કરો: ./switch. એન્ટર ડબાઓ.
  
 
|-
 
|-
06:06
+
05:00
|Type:gcc switch.c -o switch. Press Enter
+
| Enter a number between  of 0 to  39. હું 35 દાખલ કરીશ.
 +
 
 
|-
 
|-
| 06:16
+
| 05:06
| Type:./switch. Press Enter
+
| આઉટપુટ આ પ્રમાણે દર્શાવે છે,“you have entered the number in the range of 30 to 39”.
  
 +
|-
 +
|  05:10
 +
| હવે આપણે જોઈશું C++ માં પ્રોગ્રામ કેવી રીતે એક્ઝીક્યુટ કરવું.
  
 
|-
 
|-
| 06:21
+
| 05:16
| Enter a number between  of 0 to  39. I willl enter 35
+
|ટેક્સ્ટ એડિટર પર ફરીથી જાઓ.
 +
 
 
|-
 
|-
06:28
+
05:18
| The output is displayed as,“you have entered the number in the range of 30 to 39”.
+
| નોંધ લો કે આપણી ફાઈલનું નામ nested-if.cpp છે.
  
 
|-
 
|-
06:35
+
05:23
| Now we will see how to execute the program  in C++.
+
| અહીં લોજીક અને અમલીકરણ સમાન છે.
 +
 
 
|-
 
|-
| 06:44
+
| 05:27
|Switch back to the text editor.
+
| અહીં કેટલાક ફેરફાર છે, જેવા કે:
 +
 
 
|-
 
|-
06:47
+
05:30
| Note that our filename is nested-if.cpp
+
| stdio.h ના બદલે હેડર ફાઈલ iostream છે.
 +
 
 
|-
 
|-
06:55
+
05:35
| Here the logic and implementation are same
+
|અહીં આપણે using સ્ટેટમેન્ટ ઉમેર્યું છે.
  
 
|-
 
|-
| 06:59
+
| 05:39
|  There are a few changes like:
+
|-
+
|  07:03
+
|The header file as iostream in place of stdio.h
+
|-
+
|  07:08
+
|Here we have included the using statement.
+
|-
+
|  07:11
+
 
|Using namespace std
 
|Using namespace std
  
 
|-
 
|-
07:14
+
05:41
|And the  cout and cin function in place of printf and scanf.
+
|અને printf અને scanf ના બદલે cout અને cin ફન્કશન છે.
 +
 
 
|-
 
|-
07:23
+
05:46
|You can see that the rest of the code is similar to our C program.
+
|તમે જોઈ શકો છો કે બાકીનો કોડ આપણા C પ્રોગ્રામ સમાન જ છે.
  
 
|-
 
|-
07:29
+
05:51
|Let’s execute the code.
+
|ચાલો કોડ એક્ઝીક્યુટ કરીએ.
 +
 
 
|-
 
|-
07:31
+
05:53
|Come back to the terminal.
+
|ટર્મિનલ પેર ફરીથી આવો.
 +
 
 
|-
 
|-
07:34
+
05:56
|Type:  g++ nested-if.cpp -o nested1. Press Enter.
+
|ટાઇપ કરો:  g++ space nested-if.cpp space -o space nested1. એન્ટર દબાઓ.
 +
 
 
|-
 
|-
07:45
+
06:07
|Type:  ./nested1. Press Enter
+
|ટાઇપ કરો:  ./nested1. એન્ટર દબાઓ.
 +
 
 
|-
 
|-
| 07:50
+
|06:11
| enter a number between 0 and 39. I will enter 40.
+
| enter a number between 0 and 39. હું 40 દાખલ કરીશ.
 +
 
 
|-
 
|-
| 07:53
+
| 06:16
| The output is displayed as: “number not in range”
+
| આઉટપુટ આ પ્રમાણે દર્શાવે છે : “number not in range”
 +
 
 
|-
 
|-
08:06
+
|  06:20
|Now let’s see the switch program in C++
+
| હવે ચાલો સ્વીચ પ્રોગ્રામ C++ માં જોઈએ.
 +
 
 
|-
 
|-
| 08:10
+
| 06:24
|   Come back to the text editor.
+
| ટેક્સ્ટ એડિટર પર પાછા આવો.
 
   
 
   
 
|-
 
|-
| 08:14
+
|   06:27
|   Here also the logic and implementation are same.
+
|અહીં પણ લોજીક અને અમલીકરણ સમાન છે.
 +
 
 
|-
 
|-
08:19
+
06:31
| You can see that the  header file is iostream
+
| તમે જોઈ શકો છો કે હેડર ફાઈલ iostream છે.
 +
 
 
|-
 
|-
| 08:23
+
| 06:34
| Here is the using statement.
+
| અહીં using સ્ટેટમેન્ટ છે.
 +
 
 
|-
 
|-
08:25
+
06:37
| And we have changed the cout and cin function.
+
| અને આપણે cout અને cin ફન્કશન બદલ્યું છે
 +
 
 
|-
 
|-
| 08:33
+
| 06:41
| Rest of the code is similar to our switch.c C program
+
| બાકીનો કોડ આપણો switch.c પ્રોગ્રામ સમાન જ છે.
 +
 
 
|-
 
|-
| 08:38
+
| 06:45
| Let us execute.
+
| ચાલો એક્ઝીક્યુટ કરીએ.
 +
 
 
|-
 
|-
| 08:40
+
|06:46
|Come back to the terminal.
+
|ટર્મિનલ પર પાછા આવો.
 +
 
 
|-
 
|-
08:42
+
06:48
|Type:g++ switch.cpp -o switch1 Press Enter
+
|ટાઇપ કરો :g++ space switch.cpp space -o space switch1 , એન્ટર ડબાઓ.
 +
 
 
|-
 
|-
| 08:52
+
| 06:58
| Type ./switch1. Press Enter
+
| ટાઇપ કરો ./switch1. એન્ટર ડબાઓ.
 +
 
 
|-
 
|-
| 08:57
+
| 07:02
| Enter a number between 0 and 39.
+
| 0 અને 39 વચ્ચે નંબર દાખલ કરો
 +
 
 
|-
 
|-
09:00
+
07:05
| I will enter 25.
+
|હું 25 એન્ટર કરીશ.
 +
 
 
|-
 
|-
| 09:04
+
| 07:09
| The output is displayed as:
+
|આઉટપુટ આ પ્રમાણે દર્શાવે છે:
 +
 
 
|-
 
|-
09:06
+
07:11
 
|  “you have entered  the number in the range of 20-29”
 
|  “you have entered  the number in the range of 20-29”
  
 
|-
 
|-
| 09:11
+
|07:15
Now let us switch back to our slides.
+
હવે ચાલો આપણી સ્લાઈડ પર ફરીથી જઈએ.
 +
 
 
|-
 
|-
| 09:16
+
| 07:18
|We will see the comparison between  switch  and  nested-if statement.
+
| આપણે સ્વીચ અને નેસ્ટેડ ઇફ વચ્ચેનો તફાવત જોઈશું.
 +
 
 
|-
 
|-
 +
|  07:23
 +
| સ્વિચ સ્ટેટમેન્ટ એક્ષપ્રેશનના પરિણામ અનુસાર મૂલ્યાકંન કરવામાં આવ્યું છે.
  
 
|-
 
|-
| 09:21
+
| 07:28
| Switch statement is evaluated according to the result of the expression.
+
|નેસ્ટેડ ઇફ સ્ટેટમેન્ટ એક્ષપ્રેશનનું પરિણામ સાચું હોય તો જ રન થાય છે.
 +
 
 
|-
 
|-
09:28
+
07:34
|Netsed-if statement is run only if the result of the expression is true.
+
|સ્વીચમાં આપણે વેરિયેબલની વિવિધ વેલ્યુઝને કેસીસ તરીકે લઈએ છીએ.
 +
 
 
|-
 
|-
09:35
+
07:39
|In switch we treat various values of the variable as cases.  
+
|નેસ્ટેડ ઇફમાં વેરિયેબલની દરેક વેલ્યુ માટે આપણે કન્ડીશનલ સ્ટેટમેન્ટ લખવું પડે છે.
 +
 
 
|-
 
|-
| 09:41
+
|   07:45
|In nested-if we have to write the conditional statement for each value of the variable.
+
|સ્વીચ સ્ટેટમેન્ટ માત્ર ઈન્ટીજર વેલ્યુ ચેક કરે છે.  
  
 
|-
 
|-
| 09:49
+
|   07:50
| Switch statement can only check the integer values
+
|નેસ્ટેડ ઇફ પૂર્ણાંક અને અપૂર્ણાંક બંને વેલ્યુ માટે ચકાસણી કરી શકે છે.
|-
+
 
|  09:54
+
|  Nested if can check for both integer and fractional values.
+
 
|-
 
|-
10:00
+
07:55
| This brings us to the end of this tutorial.
+
| અહીં આ ટ્યુટોરીયલ સમાપ્ત થાય છે.
 
   
 
   
 
|-
 
|-
| 10:03
+
| 07:58
|Let us summarize.
+
|સારાંશ માટે,
 
   
 
   
 
|-
 
|-
| 10:05
+
| 08:00
| In this tutorial we learnt, nested if statement.
+
| આ ટ્યુટોરીયલમાં આપણે શીખ્યા , નેસ્ટેડ ઇફ સ્ટેટમેન્ટ.ઉદાહરણ તરીકે :else if( y/10 equals to 0)  
 
+
Ex: else if( y/10==0)  
+
  
 
|-
 
|-
10:13    
+
08:08    
| switch statement.
+
|સ્વીચ સ્ટેટમેન્ટ.ઉદાહરણ તરીકે: Switch(x)
e.g. Switch(x)
+
  
 
|-
 
|-
| 10:16
+
| 08:12
|And Difference between nested-if and switch statements.
+
|અને નેસ્ટેડ ઇફ અને સ્વીચ સ્ટેટમેન્ટ વચ્ચેનો તફાવત.
  
 
 
|-
 
|-
10:22
+
08:16
| As an assignment,
+
|એસાઈનમેન્ટ તરીકે,
  
 
|-
 
|-
10:23
+
08:17
| Write a program to check whether the age of the employee is between 20 to 60.
+
| કર્મચારીઓની ઉંમર 20 થી 60 વર્ષની અંદર છે કે નહી તે તપાસ કરવા માટેનો પ્રોગ્રામ લખો.
  
 
|-
 
|-
10:30
+
08:23
| Watch the video available at the link shown http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial
+
| નીચે આપેલ લીંક ઉપર ઉપલબ્ધ વિડીઓ જુઓ. http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial
  
 
|-
 
|-
10:33
+
08:26
| It summarizes the Spoken Tutorial project
+
|તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ માટે સારાંશ આપે છે.
  
 
|-
 
|-
10:36
+
08:29
| If you do not have good bandwidth, you can download and watch it.
+
|જો તમારી પાસે સારી બેન્ડવિડ્થ ન હોય તો, તમે ડાઉનલોડ કરી તે જોઈ શકો છો
  
 
|-
 
|-
| 10:40
+
| 08:33
| The Spoken Tutorial Project Team,
+
|સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ,સ્પોકન ટ્યુટોરીયલોની મદદથી વર્કશોપ આયોજિત કરે છે.
 
+
 
|-
 
|-
10:42
+
08:38
| Conducts workshops using spoken tutorials.
+
|જેઓ ઓનલાઇન પરીક્ષા પાસ કરે છે તેમને પ્રમાણપત્ર આપે છે.  
  
 
|-
 
|-
| 10:45
+
| 08:42
| Gives certificates to those who pass an online test.
+
| વધુ વિગતો માટે, contact@spoken-tutorial.org પર સંપર્ક કરો.
  
 
|-
 
|-
| 10:49
+
| 08:49
| For more details please write to    contact @spoken-tutorial.org
+
| સ્પોકન ટ્યુટોરિયલ પ્રોજેક્ટ એ ટોક ટુ અ ટીચર પ્રોજેક્ટનો એક ભાગ છે.
  
 
|-
 
|-
| 10:56
+
08:52
|  Spoken Tutorial Project is a part of the Talk to a Teacher project
+
|જે આઇસીટી, એમએચઆરડી, ભારત સરકાર દ્વારા શિક્ષણ પર નેશનલ મિશન દ્વારા આધારભૂત છે
 
+
|-
+
11:00
+
| It is supported by the National Mission on Education through ICT, MHRD, Government of India
+
  
 
|-
 
|-
| 11:08
+
|   08:58
| More information on this Mission is available at: [http://spoken-tutorial.org/ http://spoken-tutorial.org]\NMEICT-Intro
+
| આ મિશન વિશે વધુ માહીતી આ લીંક ઉપર ઉપલબ્ધ છે : : [http://spoken-tutorial.org/ http://spoken-tutorial.org]\NMEICT-Intro
  
 
|-
 
|-
| 11:13
+
| 09:04
| The script is contributed by Chaitanya Mokashi. This is Ashwini patil from IIT Bombay signing off. Thank you for joining.
+
| આઈઆઈટી બોમ્બે તરફથી ભાષાંતર કરનાર હું, કૃપાલી પરમાર વિદાય લઉં છું. જોડાવા બદ્દલ આભાર.  
  
 
|}
 
|}

Latest revision as of 12:30, 24 March 2017

Time Narration
00:01 C અને C++ નેસ્ટેડ ઇફ અને સ્વિચ સ્ટેટમેન્ટ પરના સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
00:07 આ ટ્યુટોરીયલમાં આપણે શીખીશું,
00:09 નેસ્ટેડ ઇફ અને સ્વિચ સ્ટેટમેન્ટને
00:12 કેવી રીતે વાપરવું.
00:13 આપણે આ કેટલાક ઉદાહરણોની મદદથી કરીશું.
00:17 આ ટ્યુટોરીયલ રેકોર્ડ કરવા માટે હું વાપરી રહ્યી છું,
00:20 ઉબુન્ટુ ઓપરેટીંગ સિસ્ટમ આવૃત્તિ 11.10
00:24 ઉબુન્ટુ ઉપર gcc અને g++ કમ્પાઈલર આવૃત્તિ 4.6.1.
00:30 પ્રથમ આપણે, નેસ્ટેડ ઇફ અને સ્વિચ સ્ટેટમેન્ટને કેવી રીતે લખવું તે ઉદાહરણ સાથે શીખીશું.
00:36 મેં પહેલાથી પ્રોગ્રામ લખ્યો છે.
00:39 ચાલો જોઈએ.
00:40 આ પ્રોગ્રામમાં આપણે ઈન્ટીજર ની શ્રેણી તપાસવાનું શીખીશું.
00:45 નોંધ લો કે આપણી ફાઈલનું નામ nested-if.c છે.
00:50 ચાલો હું હવે કોડ સમજાવું.
00:52 આ આપણી હેડર ફાઈલ છે.
00:54 આ આપણું મેઈન ફન્કશન છે.
00:56 મેઈન ફન્કશન અંદર આપણે બે ઈન્ટીજર વેરિયેબલ જાહેર કર્યા છે, 'x અને y'.
01:02 અહીં આપણે યુઝરને 0 થી 39 ની શ્રેણી વચ્ચે નંબર દાખલ કરવા માટે પ્રોમ્પ્ટ કરીએ છીએ.
01:08 આપણે y ની વેલ્યુ યુઝર પાસેથી ઈનપુટ તરીકે લઈએ છીએ.
01:12 આ આપણી if કન્ડીશન છે.
01:14 અહીં આપણે તપાસીશું કે y/10=0 છે કે નહી.
01:19 જો કન્ડીશન true હોય તો,
01:20 આપણે પ્રિન્ટ કરીશું, "you have entered a number in the range of 0-9.
01:25 આ આપણી else-if કન્ડીશન છે.
01:28 અહીં આપણે y/10=1 તપાસ કરીશું.
01:32 જો કન્ડીશન true હોય તો,
01:34 આપણે પ્રિન્ટ કરીશું, you have entered a number in the range of 10-19.
01:39 આ else if કન્ડીશનમાં આપણે તપાસ કરીશું કે નમ્બર 20 થી 29 ની શ્રેણી વચ્ચે છે કે નહિ.
01:45 અને અહીં આપણે જોઈશું કે નમ્બર 30 થી 39 ની શ્રેણી વચ્ચે છે કે નહિ.
01:51 આ આપણી else કન્ડીશન છે.
01:53 જો ઉપરની બધી કન્ડીશન false હોય તો,
01:55 આપણે પ્રિન્ટ કરીશું, number not in range.
01:58 અને આ આપણું રીટર્ન સ્ટેટમેન્ટ છે.
02:01 હવે ચાલો પ્રોગ્રામ એકઝીક્યુટ કરીએ.
02:03 તમારા કીબોર્ડ પર એકસાથે Ctrl + Alt + T દબાવીને, ટર્મિનલ વિન્ડો ખોલો.
02:12 એકઝીક્યુટ કરવા માટે , ટાઇપ કરો, “gcc” સ્પેસ “nested-if.c” સ્પેસ હાયફન “-o” સ્પેસ “nested”. એન્ટર ડબાઓ.
02:23 ડોટ સ્લેશ “nested” ટાઇપ કરો. એન્ટર ડબાઓ.
02:28 આપણે જોઈશું,Enter a number between 0 to 39.
02:32 હું 12 દાખલ કરીશ.
02:34 આઉટપુટ આ પ્રમાણે દર્શાવે છે:
02:35 you have entered the number in the range of 10-19.
02:40 ચાલો બીજો નમ્બર દાખલ કરીએ.
02:42 ચાલો ફરીથી એક્ઝીક્યુટ કરીએ. અપ એરો કી ડબાઓ, એન્ટર ડબાઓ.
02:48 આ વખતે હું 5 આપીશ.
02:50 આપણે આઉટપુટ આ પ્રમાણે જોઈશું :
02:52 you have entered the number in the range of 0-9.
02:56 કંડીશનલ એક્ઝેક્યુશન બીજી રીતે પણ કરી શકાય છે.
03:00 switch statement ના ઉપયોગ દ્વારા.
03:02 ચાલો જોઈએ એ કેવી રીતે કરવું.
03:05 આપણે સમાન પ્રોગ્રામ switch ના ઉપયોગ સાથે જોઈશું.
03:08 મેં પહેલાથી પ્રોગ્રામ ખોલ્યો છે.
03:10 આપણા એડિટર પર પાછા જઈએ.
03:13 મેં આ અગાઉના પ્રોગ્રામ સમજાવ્યું છે.
03:16 તો હું Switch statements ઉપર જઈશ.
03:20 અહીં, આપણે ઇનપુટ્સને વિભાજિત કરીશું, એટલે કે, y ભાગ્યા 10 અને પરિણામ x વેરિયેબલમાં સંગ્રહીશું.
03:28 એનો અર્થ એ થાય કે ભાગાકાર નું ફળ X માં સંગ્રહિત કરવામાં આવશે.
03:32 આ ભાગાકાર ના ફળ ની મદદથી આપણે નંબર શ્રેણી ઓળખી શકીએ છીએ.
03:36 અહીં, આપણે સ્વીચ કમાન્ડને કહીએ છીએ કે ચેક કરવા માટેનો વેરિયેબલ x છે.
03:41 case 0 છે. જો case 0 બરાબર છે
03:45 તો આપણે પ્રિન્ટ કરીશું, you have entered the number in the range of 0-9.
03:51 જો કેસ બરાબર હોય તો લૂપમાંથી બહાર નીકળવા માટે આપણે break ઉમેરીશું.
03:55 આપણે લુપને દરેક વખતે બ્રેક કરવું પડશે.
03:58 કારણ કે, એક સમયે ફક્ત એક જ કન્ડીશન true હોઈ શકે.
04:03 આ “case 1” છે. “case 1” એટલે કે “જો x ની વેલ્યુ 1 હોય,
04:08 તો આપણે પ્રિન્ટ કરીશું, you have entered a number in the range of 10-19.
04:12 આ “case 2” છે.
04:14 અહીં આપણે પ્રિન્ટ કરીશું, you have entered a number in the range of 20-29.
04:20 અને આ case 3 છે, અહીં આપણે તપાસ કરીશું કે નમ્બર 30-39 ની શ્રેણીમાં છે કે નહી.
04:26 આ ડીફોલ્ટ કેસ છે. ડિફૉલ્ટ કેસ, ઉપરના કોઈ પણ કેસો બરાબર ન હોય તો શું કરવાની જરૂર છે તે સ્પષ્ટ કરે છે.
04:36 અહીં આપણે પ્રિન્ટ કરીશું, "number not in range"
04:39 અને આ આપણું રીટર્ન સ્ટેટમેન્ટ છે.
04:41 ચાલો પ્રોગ્રામ એક્ઝીક્યુટ કરીએ.
04:43 ટર્મિનલ પર પાછા જઈએ.
04:46 ટાઇપ કરો gcc space switch.c space -o space switch. એન્ટર ડબાઓ.
04:55 ટાઇપ કરો: ./switch. એન્ટર ડબાઓ.
05:00 Enter a number between of 0 to 39. હું 35 દાખલ કરીશ.
05:06 આઉટપુટ આ પ્રમાણે દર્શાવે છે,“you have entered the number in the range of 30 to 39”.
05:10 હવે આપણે જોઈશું C++ માં પ્રોગ્રામ કેવી રીતે એક્ઝીક્યુટ કરવું.
05:16 ટેક્સ્ટ એડિટર પર ફરીથી જાઓ.
05:18 નોંધ લો કે આપણી ફાઈલનું નામ nested-if.cpp છે.
05:23 અહીં લોજીક અને અમલીકરણ સમાન છે.
05:27 અહીં કેટલાક ફેરફાર છે, જેવા કે:
05:30 stdio.h ના બદલે હેડર ફાઈલ iostream છે.
05:35 અહીં આપણે using સ્ટેટમેન્ટ ઉમેર્યું છે.
05:39 Using namespace std
05:41 અને printf અને scanf ના બદલે cout અને cin ફન્કશન છે.
05:46 તમે જોઈ શકો છો કે બાકીનો કોડ આપણા C પ્રોગ્રામ સમાન જ છે.
05:51 ચાલો કોડ એક્ઝીક્યુટ કરીએ.
05:53 ટર્મિનલ પેર ફરીથી આવો.
05:56 ટાઇપ કરો: g++ space nested-if.cpp space -o space nested1. એન્ટર દબાઓ.
06:07 ટાઇપ કરો: ./nested1. એન્ટર દબાઓ.
06:11 enter a number between 0 and 39. હું 40 દાખલ કરીશ.
06:16 આઉટપુટ આ પ્રમાણે દર્શાવે છે : “number not in range”
06:20 હવે ચાલો સ્વીચ પ્રોગ્રામ C++ માં જોઈએ.
06:24 ટેક્સ્ટ એડિટર પર પાછા આવો.
06:27 અહીં પણ લોજીક અને અમલીકરણ સમાન છે.
06:31 તમે જોઈ શકો છો કે હેડર ફાઈલ iostream છે.
06:34 અહીં using સ્ટેટમેન્ટ છે.
06:37 અને આપણે cout અને cin ફન્કશન બદલ્યું છે
06:41 બાકીનો કોડ આપણો switch.c પ્રોગ્રામ સમાન જ છે.
06:45 ચાલો એક્ઝીક્યુટ કરીએ.
06:46 ટર્મિનલ પર પાછા આવો.
06:48 ટાઇપ કરો :g++ space switch.cpp space -o space switch1 , એન્ટર ડબાઓ.
06:58 ટાઇપ કરો ./switch1. એન્ટર ડબાઓ.
07:02 0 અને 39 વચ્ચે નંબર દાખલ કરો
07:05 હું 25 એન્ટર કરીશ.
07:09 આઉટપુટ આ પ્રમાણે દર્શાવે છે:
07:11 “you have entered the number in the range of 20-29”
07:15 હવે ચાલો આપણી સ્લાઈડ પર ફરીથી જઈએ.
07:18 આપણે સ્વીચ અને નેસ્ટેડ ઇફ વચ્ચેનો તફાવત જોઈશું.
07:23 સ્વિચ સ્ટેટમેન્ટ એક્ષપ્રેશનના પરિણામ અનુસાર મૂલ્યાકંન કરવામાં આવ્યું છે.
07:28 નેસ્ટેડ ઇફ સ્ટેટમેન્ટ એક્ષપ્રેશનનું પરિણામ સાચું હોય તો જ રન થાય છે.
07:34 સ્વીચમાં આપણે વેરિયેબલની વિવિધ વેલ્યુઝને કેસીસ તરીકે લઈએ છીએ.
07:39 નેસ્ટેડ ઇફમાં વેરિયેબલની દરેક વેલ્યુ માટે આપણે કન્ડીશનલ સ્ટેટમેન્ટ લખવું પડે છે.
07:45 સ્વીચ સ્ટેટમેન્ટ માત્ર ઈન્ટીજર વેલ્યુ ચેક કરે છે.
07:50 નેસ્ટેડ ઇફ પૂર્ણાંક અને અપૂર્ણાંક બંને વેલ્યુ માટે ચકાસણી કરી શકે છે.
07:55 અહીં આ ટ્યુટોરીયલ સમાપ્ત થાય છે.
07:58 સારાંશ માટે,
08:00 આ ટ્યુટોરીયલમાં આપણે શીખ્યા , નેસ્ટેડ ઇફ સ્ટેટમેન્ટ.ઉદાહરણ તરીકે :else if( y/10 equals to 0)
08:08 સ્વીચ સ્ટેટમેન્ટ.ઉદાહરણ તરીકે: Switch(x)
08:12 અને નેસ્ટેડ ઇફ અને સ્વીચ સ્ટેટમેન્ટ વચ્ચેનો તફાવત.
08:16 એસાઈનમેન્ટ તરીકે,
08:17 કર્મચારીઓની ઉંમર 20 થી 60 વર્ષની અંદર છે કે નહી તે તપાસ કરવા માટેનો પ્રોગ્રામ લખો.
08:23 નીચે આપેલ લીંક ઉપર ઉપલબ્ધ વિડીઓ જુઓ. http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial
08:26 તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ માટે સારાંશ આપે છે.
08:29 જો તમારી પાસે સારી બેન્ડવિડ્થ ન હોય તો, તમે ડાઉનલોડ કરી તે જોઈ શકો છો
08:33 સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ,સ્પોકન ટ્યુટોરીયલોની મદદથી વર્કશોપ આયોજિત કરે છે.
08:38 જેઓ ઓનલાઇન પરીક્ષા પાસ કરે છે તેમને પ્રમાણપત્ર આપે છે.
08:42 વધુ વિગતો માટે, contact@spoken-tutorial.org પર સંપર્ક કરો.
08:49 સ્પોકન ટ્યુટોરિયલ પ્રોજેક્ટ એ ટોક ટુ અ ટીચર પ્રોજેક્ટનો એક ભાગ છે.
08:52 જે આઇસીટી, એમએચઆરડી, ભારત સરકાર દ્વારા શિક્ષણ પર નેશનલ મિશન દ્વારા આધારભૂત છે
08:58 આ મિશન વિશે વધુ માહીતી આ લીંક ઉપર ઉપલબ્ધ છે : : http://spoken-tutorial.org\NMEICT-Intro
09:04 આઈઆઈટી બોમ્બે તરફથી ભાષાંતર કરનાર હું, કૃપાલી પરમાર વિદાય લઉં છું. જોડાવા બદ્દલ આભાર.

Contributors and Content Editors

Jyotisolanki, Krupali, Pratik kamble