C-and-Cpp/C2/Nested-If-And-Switch-Statement/Khasi
From Script | Spoken-Tutorial
Time | Narration |
00:01 | Ngi pdiangsngewbha ia phi sha ka Nested if and Switch statements in C and C++. |
00:07 | Ha kane ka jinghikai, ngin pule shaphang, |
00:09 | Kumno ban pyndonkam ia ka nested if statement bad |
00:12 | switch statement. Ngin leh ia kane da ka jingiarap jong ki nuksa. |
00:17 | Ban record ia ka jinghikai, Nga pyndonkam da ka |
00:20 | Ubuntu operating system version 11.10, |
00:24 | gcc and g++ Compiler version 4.6.1 on Ubuntu. |
00:30 | Nyngkong ngin pule kumno ban thoh nested if bad switch statements lyngba ki nuksa. |
00:36 | Nga lah thoh ia ka prokram. |
00:39 | To ngin ia peit. Ha kane ka prokram ngin pule ruh kumno ban check ia ka range jong ki integers. |
00:45 | Kynmaw ba ka kyrteng ka phail jongngi ka long nested-if.c. |
00:50 | To ngan batai ka code mynta. |
00:52 | Kane ka dei ka Header phail jong ngi. |
00:54 | Kane ka dei ka main() function jongngi. |
00:56 | Hapoh ka main() function ngi lah declare ia ki artylli ki integer variables 'x and y'. |
01:02 | Hangne ngi prompt ia ki nongpyndonkam ban pynrung ia ki number hapdeng 0 to 39. |
01:08 | Ngin shim ia u value y kum ka input na u nongpyndonkam. |
01:12 | Kane ka long ka if condition jongngi. |
01:14 | Hangne, ngin peit la u y/10=0. |
01:19 | Lada ka condition ka dei, ngin print "you have entered the number in the range of 0-9". |
01:25 | Kane ka dei ka else-if condition jongngi. |
01:28 | Hangne ngin peit ba u y/10 un iaryngkat ia u 1. |
01:32 | Lada ka condition ka dei, |
01:34 | Ngi print "you have entered a number in the range of 10-19". |
01:39 | Ha kane ka else if condition ngin peit la ki number ki don ka range jong 20-29. |
01:45 | Bad hangne ngin iohi ba ki number ka don ha ka range jong 30 to 39. |
01:51 | Kane ka dei ka else condition jongngi. |
01:53 | Lada baroh kiba haneng ki conditions kim dei, |
01:55 | Ngin print "number not in range". |
01:58 | Bad kane ka dei ka return statement jongngi. |
02:01 | Mynta to ngin execute ia ka prokram. |
02:03 | Sngewbha plie ia ka terminal window da kaba nion Ctrl+Alt and T keys ha ka juh ka por na ka keyboard jong phi. |
02:12 | Ban execute, type gcc space nested-if.c space hyphen o space nested. Press Enter. |
02:23 | Type dot slash “nested” (./nested). Press Enter. |
02:28 | Ngi iohi Enter a number between 0 to 39. |
02:32 | Ngan enter 12. |
02:34 | Ia ka output yn pyni kumne: |
02:35 | you have entered the number in the range of 10-19. |
02:40 | To ngin enter da u wei pat u number. |
02:42 | To ngin execute sa shisien. Nion u up arrow key, nion Enter. |
02:48 | Ngan ai 5 mynta ka kynti. |
02:50 | Ngin iohi ia ka output kum: |
02:52 | you have entered the number in the range of 0-9. |
02:56 | Ka conditional execution lah ban pyndep da kumwei ruh. |
03:00 | Da kaba pyndonkam switch statement. |
03:02 | To ngin peit kumno la pyndep. |
03:05 | Ngin iohi ba ka juh ka prokram ba pyndonkam switch'. |
03:08 | Nga lah plie ia ka prokram. |
03:10 | To ngin switch biang sha ka text editor jong ngi. |
03:13 | Nga lah batai ia kane ha ka prokram ba lah dep. |
03:16 | Te ngan iaid noh sha ka switch statements. |
03:20 | Hangne, ngin phiah ia ka input i.e y by 10 bad ka result la buh ha ka variable x.
|
03:28 | Kaba mut ka quotient yn buh hapoh u x. |
03:32 | Da ka jingiarap jong u quotient ngi lah ban pyni ia ka range jong u number. |
03:36 | Hangne, ngin ong ia ka switch command ba ia u variable ba hap ban check u long x. |
03:41 | Kane kan long case 0 . Lada ka case 0 kan biang |
03:45 | Namarkata ngi print you have entered the number in the range of 0-9. |
03:51 | Ngin add break ban mih na ka loop lada ka case ka lah biang. |
03:55 | Ngi donkam ban break ia ka loop man ka por. |
03:58 | Kane ka long namar tang kawei ka condition kan dei ha kato ka por. |
04:03 | Kane ka “case 1”. “case 1” ka mut “if the value of x is 1”. |
04:08 | Ngin print you have entered a number in the range of 10-19. |
04:12 | Kane ka “case 2” . |
04:14 | Hangne ngi print you have entered a number in the range of 20-29. |
04:20 | Bad kane ka case 3. Hangne ngin check la ka number ka don ha ka range jong 30-39. |
04:26 | Kane ka dei ka default case. Default case ka batai ia ka ba donkam ban pyndep la da ym don na kitei ki case ki ba biang. |
04:36 | Hangne ngi print "number not in range". |
04:39 | Bad kane ka dei ka return statement jongngi. |
04:41 | To ngin execute ia ka prokram. |
04:43 | Switch biang sha ka terminal. |
04:46 | Type gcc space switch.c space -o space switch. Nion Enter. |
04:55 | Type ./switch(dot slash switch). Nion Enter. |
05:00 | Enter ia u number hapdeng u 0 haduh 39. Ngan enter 35. |
05:06 | Ia Ka output yn pyni kum “you have entered the number in the range of 30 to 39”. |
05:10 | Mynta ngin peit kumno ban execute ia ka prokram ha ka C++. |
05:16 | Switch biang sha ka text editor. |
05:18 | Kynmaw ba ka kyrteng ka phail jong ngi ka long nested-if.cpp. |
05:23 | Hangne ka logic bad implementation ka dei ka juh. |
05:27 | Kan don khyndiat ki jingkylla kum: |
05:30 | Ka header phail kum "iostream" ha jaka jong "stdio.h". |
05:35 | Hangne ngin kynthup ia ka using statement |
05:39 | Using namespace std. |
05:41 | Bad ka cout bad cin function ha jaka jong ka printf bad scanf. |
05:46 | Phin iohi ia baroh ki code ba iasryiem jong ka C prokram jong ngi. |
05:51 | To ngin execute ia ka code. |
05:53 | Phai biang sha ka terminal. |
05:56 | Type g++ space nested-if.cpp space -o space nested1. Nion Enter. |
06:07 | Type ./nested1. Nion Enter. |
06:11 | Enter ia u number hapdeng 0 haduh 39. Ngan enter 40. |
06:16 | Ia ka output la pyni kum: “number not in range” |
06:20 | Mynta to ngin peit ia ka switch prokram ha ka C++. |
06:24 | Phai biang sha ka text editor jong ngi. |
06:27 | Hangne ruh ka logic bad implementation ki long kumjuh. |
06:31 | Phi lah ban iohi ba ka header phail ka long iostream. |
06:34 | Hangne don ka using statement. |
06:37 | Bad ngi lah pynkylla ia ka cout bad cin function. |
06:41 | Kiwei pat ki code kin iasryiem ia ka switch C prokram jongngi. |
06:45 | To ngin execute. Phai biang sha ka terminal jongngi. |
06:48 | Type g++ space switch.cpp space -o space switch1. Nion Enter. |
06:58 | Type ./switch1. Nion Enter. |
07:02 | Enter u number hapdeng 0 to 39. |
07:05 | Ngan enter 25. |
07:09 | Ia ka output yn pyni kum: |
07:11 | “you have entered the number in the range of 20-29” |
07:15 | Mynta ngin switch biang sha ka slides jongngi. |
07:18 | Ngin peit ia ka jingiapher hapdeng ka switch bad nested-if statements. |
07:23 | Switch statement la khein katkum ka jingmih na ka expression. |
07:28 | Netsed-if statement la run tang lada ka jingmih jong ka expression ka dei. |
07:34 | Ha ka switch, ngi khein ia baroh ki values jong u variable kum cases. |
07:39 | Ha ka nested-if ngin hap ban thoh ia ka conditional statement jong ka wei paka wei ka value jong u variable. |
07:45 | Switch statement ka lah tang ban check ia ka integer values. |
07:50 | Nested if ka lah ban check ia baroh ar, integer bad fractional values. |
07:55 | Da kane ngi lah poi sha kaba kut jong ka jinghikai. |
07:58 | To ngin batai lyngkot. |
08:00 | Ha kane ka jinghikai, ngi lah tip shaphang ka * 'nested if' statement. e.g. else if( y/10 equals to 0) |
08:08 | switch statement. e.g. switch(x) bad |
08:12 | Ka jingiapher hapdeng ka nested-if bad switch statements. |
08:16 | Kum ka assignment, thoh ia ka prokram ban check la ka ryta jong u nongtrei ka long hapdeng 20 to 60. |
08:23 | Peit ia ka video ha ka link ba la pyni harum
http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial. |
08:26 | Ka batai lyngkong shaphang ka Spoken Tutorial project. |
08:29 | Lada phim don ka bor internet ba khlain, phi lah ban shu download sa peit pat hadien. |
08:33 | Ka team Spoken Tutorial Project:* ka pynlong ki workshop da ba pyndonkam ia ki spoken tutorials. |
08:38 | * Yn ai syrnod ia kiba pass ia ka online test. |
08:42 | Na bynta ka jingtip ba kham bniah, sngewbha thoh sha ka
contact@spoken-tutorial.org |
08:49 | “Spoken Tutorial” Project ka dei ka bynta jong ka Talk to a Teacher. |
08:52 | La kyrshan ia kane ka project da ka National Mission on Education lyngba ICT, MHRD, jong ka sorkar India. |
08:58 | Shuh shuh ki jingtip halor kane ka mission phin ioh na kane ka link ba la ai harum : http://spoken-tutorial.org\NMEICT-Intro. |
09:04 | La pynkylla sha ka ktien khasi da i Godwin pyrbot bad nga i John Nongkynrih.
Khublei naka bynta ba iasnohlang. |