C-and-C++/C4/Working-With-Structures/Gujarati

From Script | Spoken-Tutorial
Revision as of 16:46, 10 September 2013 by Krupali (Talk | contribs)

Jump to: navigation, search
Time' Narration


00:01 C અને C++ માં સ્ટ્રક્ચર્સ પરના સ્પોકન-ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
00:06 આ ટ્યુટોરીયલમાં આપણે શીખીશું,


00:09 સ્ટ્રક્ચર્સ શું છે?


00:11 સ્ટ્રક્ચર્સ જાહેર કરવું.
00:13 આપણે આ ઉદાહરણ મારફતે કરીશું.
00:16 આ ટ્યુટોરીયલ રેકોર્ડ કરવા માટે, હું ઉપયોગ કરું છું


00:19 Ubuntu Operating System આવૃત્તિ 11.10,


00:23 gcc અને g++ કમ્પાઈલર આવૃત્તિ 4.6.1
00:29 ચાલો સ્ટ્રક્ચર્સ ના પરિચય સાથે શરૂ કરીએ.
00:32 એક અથવા વધુ વેરિયેબલ્સ એક નામ હેઠળ જૂથ થયેલ હોય તે સ્ટ્રક્ચર્સ તરીકે ઓળખાય છે.
00:38 સ્ટ્રક્ચર્સ એક ઓબ્જેક્ટમાં અલગ અલગ ડેટાને ગ્રુપ કરવા માટે વપરાય છે.
00:43 તે compound data-type તરીકે ઓળખાય છે.
00:45 તે સંબંધિત માહિતીને એકસાથે જૂથ કરવા માટે વપરાય છે.
00:49 હવે આપણે,
00:50 સ્ટ્રક્ચર જાહેર કરવા માટેનું સીન્ટેક્ષ જોઈશું.
00:53 અહીં કીવર્ડ સ્ટ્રક્ટ કમ્પાઇલરને કહે છે કે સ્ટ્રક્ચર જાહેર કરવામાં આવેલ છે.


00:59 strcut_name એ સ્ટ્રક્ચરનું નામ છે.


01:03 ઉદાહરણ તરીકે. struct employee;
01:05 તમે કોઇપણ નામ આપી શકો છો.
01:07 હવે આપણે જોઈશું કે સ્ટ્રક્ચર વેરિયેબલ કેવી રીતે જાહેર કરવું.


01:12 આ માટે સીન્ટેક્ષ છે,


01:14 struct struct_name અને struct_var;


01:17 struct_varstruc_name ટાઇપ નો વેરિયેબલ છે.


01:22 ઉદાહરણ તરીકે. struct employee addr;
01:27 addremployee ટાઇપ નો વેરિયેબલ છે.
01:31 ચાલો આપણા ઉદાહરણ પર જઈએ.
01:33 મેં એડિટરમાં પહેલેથી જ પ્રોગ્રામ લખ્યો છે
01:36 તો ચાલો હું તે ખોલું.
01:38 Note that our filename is structure.c
01:42 In this program we will calculate the total marks of three subjects using structure
01:49 Let me explain the code now.
01:51 This is our header file.
01:53 Here we have declared a structure as student.



01:57 Then we have declared three integer variables as english, maths and science.


02:04 Variables defined under the structure are called as members of the structure.
02:10 This is our main function
02:12 Here we have declared an integer variable total.
02:17 Now we have declared a structure variable stud. stud is the variable of type student,it is used to access and modify the structure members



02:30 Here we have modified the members
02:32 By assigning them values as 75, 70 and 65.
02:38 Here we calculate the total of three subjects.
02:42 Then we print the result.
02:44 This is our return statement.
02:47 Now click on Save
02:49 Let us execute the program
02:51 Please open the terminal window by pressing
02:54 Ctrl, Alt and T keys simultaneously on your keyboard.
03:00 To compile
03:01 Type; gcc space structure.c space -o space struct
03:10 And press Enter
03:12 To execute
03:13 Type./struct Press Enter
03:18 The output is displayed as: Total is 210
03:22 Now we will execute the same program in C++
03:26 Come back to our program.
03:28 I will edit the same code
03:31 First press shift, cntrl and S keys simultaneously on the keyboard
03:37 Now save the file with an extension .cpp and click on save
03:44 Let us change the header file as iostream
03:48 Now include the using statement and click on save
03:57 Structure declaration in C++ is same as in C
04:02 So no need to change anything here
04:05 At the end we will replace the printf statement with the cout statement.
04:08 Delete the format specifier and \n
04:16 Now delete the comma
04:17 Type two opening angle brackets.
04:21 Here delete the closing bracket
04:23 and type two opening angle backets
04:25 And within the double quotes type \n
04:29 Now click on Save
04:31 Let us execute the program
04:33 Come back to our terminal
04:35 To compile type g++ space structure.cpp space -o space struct1
04:47 Here we have struct1 because we dont want to overwrite the output parameters for the file structure.c
04:55 Now press Enter
04:57 To execute type ./struct1
05:02 Press Enter
05:04 The output is displayed as: Total is 210
05:08 You can see that the output is same as our C code
05:12 Now let us go back to our slides.
05:15 We will summarize now. In this tutorial we learned,
05:18 Structure.
05:19 Syntax of a structure.
05:21 eg. struct struct_name;
05:24 To access members of a structure.
05:26 Eg: stud.maths = 75;
05:30 To add the structure variables.
05:33 Eg: total = stud.eng + stud.maths + stud.science;
05:40 As an assignment,
05:41 Write a program to diplay the records of an employee.
05:45 Like name, address, designation, salary.
05:49 Watch the video available at the link shown below
05:53 It summarises the Spoken Tutorial project
05:55 If you do not have good bandwidth, you can download and watch it
06:00 The Spoken Tutorial Project Team
06:02 Conducts workshops using spoken tutorials
06:05 Gives certificates to those who pass an online test
06:08 For more details, please write to contact@spoken-tutorial.org
06:15 Spoken Tutorial Project is a part of the Talk to a Teacher project
06:19 It is supported by the National Mission on Education through ICT, MHRD, Government of India
06:26 More information on this Mission is available at: http://spoken-tutorial.org\NMEICT-Intro
06:30 This is Ashwini Patil from IIT Bombay. Siginning off.
06:33 Thank You for joining

Contributors and Content Editors

Krupali, Pratik kamble