C-and-C++/C2/Logical-Operators/Gujarati

From Script | Spoken-Tutorial
Revision as of 12:53, 9 September 2013 by Jyotisolanki (Talk | contribs)

Jump to: navigation, search
Time Narration
00.02 Logical operators in C and C++ પરનાં સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
00.08 આ ટ્યુટોરીયલમાં આપણે આપેલ વિશે શીખીશું: લોજીકલ ઓપરેટરો જેમ કે && લોજીકલ એન્ડ ઉ.દા. expression1 && expression2
00.17 લોજીકલ ઓર

ઉ.દા. expression1 || expression2

00.21 ! લોજીકલ નોટ

ઉ.દા. !(Expression1)

00.25 આપણે આ ઉદાહરણોની મદદથી કરીશું.
00.28 આ ટ્યુટોરીયલ રેકોર્ડ કરવા માટે, ઓપરેટિંગ સિસ્ટમ તરીકે હું ઉબુન્ટુ 11.10,
00.34 ઉબુન્ટુમાં gcc અને g++ કમ્પાઇલર આવૃત્તિ 4 .6.1 નો ઉપયોગ કરી રહ્યી છું.
00.40 ચાલો લોજીકલ ઓપરેટરોનાં પરિચય સાથે શરૂઆત કરીએ.
00.44 C and C++ માં, true0 કરતાં અન્ય કોઈ એક વેલ્યુ છે.
00.49 શૂન્ય ન હોવાનો અર્થ true છે
00.51 Non zero = True શૂન્ય એટલે false Zero = False


00.53 એક્સપ્રેશન જે લોજીકલ ઓપરેટરોનો ઉપયોગ કરે છે તે true માટે 1 અને false માટે 0 return કરે છે.
00.59 હવે હું એક ઉદાહરણની મદદથી લોજીકલ ઓપરેટરો સમજાવીશ.
01.04 અહીં આ C માં લોજીકલ ઓપરેટરો માટેનું પ્રોગ્રામ છે.
01.09 main બ્લોકની અંદર
01.11 આ સ્ટેટમેંટ a,b અને c વેરીએબલોને ઇન્ટીજર તરીકે જાહેર કરે છે.
01.16 printf સ્ટેટમેંટ વપરાશકર્તાને a,b અને c ની વેલ્યુઓ દાખલ કરવા માટે પ્રોમ્પ્ટ કરે છે.
01.22 scanf સ્ટેટમેંટ વપરાશકર્તા પાસેથી a,b અને c વેરીએબલો માટે ઈનપુટ લે છે.
01.28 અહીં, આપણે મહત્તમ વેલ્યુ શોધવા માટે વેલ્યુ a ની તુલના વેલ્યુ b અને c થી કરી રહ્યા છીએ.
01.33 વારાફરતી તુલના માટે, આપણે લોજીકલ એન્ડ ઓપરેટરનો ઉપયોગ કરીએ છીએ.
01.38 અહીં, લોજીકલ એન્ડ true વેલ્યુ return કરે એ માટે તમામ કંડીશનોનું true હોવું જરૂરી છે.
01.44 false કંડીશન મળવા પર પદાવલી આગળ ઉકેલાશે નહી.
01.49 આમ, (a>c) પદાવલી ફક્ત ત્યારે જ ઉકેલાશે જયારે (a>b) true હોય છે.
01.57 જો ab કરતા નાનો હોય, ત્યારે પદાવલી આગળ ઉકેલાશે નહી.
02.03 જો પહેલાની કંડીશન true હોય તો આ સ્ટેટમેંટ ઉકેલાય છે.
02.07 આગળ (b>c) ઉકેલાય છે.
02.10 If the condition is true, then b is greatest is displayed on the screen.
02.17 Otherwise c is greatest is displayed on the screen.
02.21 We now come to the logical OR operator.
02.24 Here, any one of the conditions has to be true for logical OR to return a true value.
02.31 The expression is not evaluated further on encountering a true condition.
02.36 So, if a == zero, then the remaining two expressions won't be evaluated.
02.43 This printf statement is executed if either of a, b or c is 0.
02.49 Coming to the end of the program. return 0 and ending curly bracket.
02.54 Now save the program.
02.58 Save it with extension .c
03.00 I have saved my file as logical.c
03.04 Open the terminal by pressing Ctrl, Alt and T keys simulataneously.
03.09 To compile the code type gcc logical.c -o log Press enter
03.23 To execute type ./log
03.27 Press Enter.


03.30 I will enter the values as,

0

34

567

03.40 The output is displayed as,
03.43 c is greatest.
03.46 The product of a, b and c is zero.
03.50 You should try executing this program with different sets of inputs.
03.55 Now Let's write the same program in C++
03.59 I have already made the program and will take you through it.
04.03 Here is the code in C++.
04.07 Now to make the same program in C++, we make a few changes.
04.12 There's a change in the header file.
04.15 Using statement has been used.
04.18 Also there is a difference in output and input statements.
04.22 The operators behave in the same way as they did in C.


04.26 Click on Save.
04.27 Make sure the file is saved with extension .cpp
04.31 Open the terminal by pressing Ctrl, Alt and T keys simulataneously.
04.37 To compile the program type g++ logical.cpp -o log1
04.49 to execute type ./log1
04.54 press Enter.


04.56 I will enter the values as

0

34

567

05.02 So We see the output is similar to the C program.
05.05 You should try executing the program with different sets of inputs too.
05.10 Now let us see an error which we can come across.
05.13 Let's switch to the editor.
05.16 Suppose here we forgot the brackets.
05.20 Delete this and this.
05.26 Let see what will happen, Save the program.
05.31 Come back to the terminal
05.33 Compile and execute as before
05.38 We see the error:
05.41 Expected identifier before '(' token.
05.46 This is because we have two different expressions here
05.49 We have to evaluate them as one expression using AND operator.
05.53 Now let us go back to our program and fix the error
05.58 Let us insert the brackets here and here.
06.04 Click on Save
06.07 Come back to the terminal.
06.09 Let us compile and execute as before
06.14 So it is working now.
06.22 Let us now summarize the tutorial.
06.24 In this tutorial we learnt about && Logical AND eg. ((a > b) && (a > c))


06.32 Logical OR

eg. (a == 0 || b == 0 || c == 0)


06.40 Assignment
06.41 Write a program that takes two numbers as input from the user.
06.45 Check whether the two numbers are equal or not using NOT operator. Hint: (a != b)
06.54 નીચે આપેલ લીંક ઉપર ઉપલબ્ધ વિડીઓ જુઓ.
06.57 તે સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ માટે સારાંશ આપે છે.
06.59 જો તમારી પાસે સારી બેન્ડવિડ્થ ન હોય તો, તમે ડાઉનલોડ કરી તે જોઈ શકો છો
07.03 સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ ટીમ * સ્પોકન ટ્યુટોરીયલોની મદદથી વર્કશોપ આયોજિત કરે છે.
07.08 જેઓ ઓનલાઇન પરીક્ષા પાસ કરે છે તેમને પ્રમાણપત્ર આપે છે.
07.11 વધુ વિગતો માટે, contact at spoken hyphen tutorial dot org પર સંપર્ક કરો.
07.18 સ્પોકન ટ્યુટોરીયલ પ્રોજેક્ટ એ ટોક ટુ અ ટીચર પ્રોજેક્ટનો એક ભાગ છે
07.21 જે આઇસીટી, એમએચઆરડી, ભારત સરકાર દ્વારા શિક્ષણ પર નેશનલ મિશન દ્વારા આધારભૂત છે.
07.27 આ મિશન વિશે વધુ માહીતી આ લીંક ઉપર ઉપલબ્ધ છે:
07.30 spoken hyphen tutorial dot org slash NMEICT hyphen Intro
07.37 આઈઆઈટી બોમ્બે તરફથી ભાષાંતર કરનાર હું, જ્યોતી સોલંકી વિદાય લઉં છું.

જોડાવા બદ્દલ આભાર.

Contributors and Content Editors

Jyotisolanki, Krupali, Pratik kamble