C-and-C++/C2/Functions/Bengali

From Script | Spoken-Tutorial
Revision as of 11:28, 11 September 2013 by Kaushik Datta (Talk | contribs)

Jump to: navigation, search
Time' Narration


00.01 C এবং C ++ এ ফাংশনসের কথ্য টিউটোরিয়ালে আপনাদের স্বাগত।
00.07 এই টিউটোরিয়ালে আমরা শিখব,
00.10 ফাংশন কি?
00.12 ফাংশনের সিনটেক্স।
00.15 রিটার্ন স্টেটমেন্টের গুরূত্ব।
00.18 ফাংশনের কয়েকটি উদাহরণ।
00.20 আমরা কিছু সাধারণ এরর এবং তাদের সমাধান ও দেখবো।
00.25 এই টিউটোরিয়ালটি রেকর্ড করতে আমি উবুন্টু অপারেটিং সিস্টেম সংস্করণ 11.10
00.33 এবং gcc এবং g ++ কম্পাইলার সংস্করণ 4.6.1 ব্যবহার করছি।
00.40 ফাংশনের ভূমিকা দিয়ে শুরু করা যাক।
00.43 ফাংশন হল স্বয়ংসম্পূর্ণ প্রোগ্রাম যা একটি নির্দিষ্ট কাজ এক্সিকিউট করে।
00.50 প্রতিটি প্রোগ্রাম এক বা একাধিক ফাংশন নিয়ে গঠিত।
00.56 একবার এক্সিকিউটের পর কন্ট্রোল যেখান থেকে অ্যাক্সেস করা হয়েছে সেখানে ফেরত পাঠানো হবে।
01.03 এখন আমরা ফাংশনের জন্য সিনট্যাক্স দেখতে পারব।
01.18 ret-type ফাংশনের ফেরৎ দেওয়া তথ্য সংজ্ঞায়িত করে।
01.12 fun-name হল ফাংশনের নাম।
01.16 parameters হল ভ্যারিয়েবলের নাম এবং তাদের ধরনের সূচী।
01.20 এই ফাংশনের আরেকটি সিনটেক্স হল ret-type fun-name and empty parameter list.
01.30 একে আর্গুমেন্ট ছাড়া ফাংশন বলা হয়।
01.35 এবং একে আর্গুমেন্ট সহ ফাংশন বলা হয়।
01.40 এখন প্রোগ্রামের দিকে যাওয়া যাক।
01.43 আমি ইতিমধ্যে এডিটরে প্রোগ্রাম লিখে ফেলেছি।
01.46 এটি খুলি।
01.50 উল্লেখ্য যে আমাদের ফাইলের নাম void function.c এই প্রোগ্রামে আমরা ফাংশন ব্যবহার করে দুটি সংখ্যার যোগফল নির্ণয় করব।
02.03 আমি এখন কোড ব্যাখ্যা করি।
02.06 এটি আমাদের হেডার ফাইল।
02.09 কোনো ফাংশন ব্যবহার করার পূর্বে তা সংজ্ঞায়িত করা আবশ্যক।
02.14 আমরা এখানে add নামক একটি ফাংশন ঘোষিত করেছি।
02.18 উল্লেখ্য যে এড ফাংশন কোনো আর্গুমেন্ট ছাড়াই।
02.22 এবং রিটার্ন টাইপ হল void.
02.25 এখানে দুই ধরনের ফাংশন আছে।
02.27 প্রথমটি হল ইউসার-ডিফাইনড ফাংশন যা আমাদের add ফাংশন এবং
02.33 প্রি-ডিফাইনড ফাংশন যা printf এবং main ফাংশন।
02.39 এখানে আমরা a এবং b কে 2 এবং 3 মান নির্দিষ্ট করে শুরু করেছি।
02.47 তারপর আমরা একটি ভ্যারিয়েবল C ঘোষিত করেছি।
02.51 আমরা a এবং b এর মান যোগ করি।
02.53 ফলাফল C তে সংরক্ষিত হয়েছে।
02.57 তারপর আমরা ফলাফল প্রিন্ট করি।
03.00 এই আমাদের মেন ফাংশন।
03.03 মেন ফাংশনের ভিতরে, আমরা add ফাংশন রাখি।
03.07 এডিশন অপারেশন সঞ্চালিত করা হবে এবং ফলাফল প্রিন্ট করা হবে।
03.13 এখন save এ টিপুন।
03.15 প্রোগ্রাম এক্সিকিউট করি।
03.17 আপনার কীবোর্ড Ctrl, Alt এবং T একসাথে টিপে টার্মিনাল উইন্ডো খুলুন।
03.28 কম্পাইল করতে লিখুন
03.29 gcc void function.c -o void এবং enter টিপুন।
03.40 এক্সিকিউট করতে লিখুন ./void
03.45 আউটপুট Sum of a and b is 5 হিসাবে প্রদর্শিত হয়েছে।
03.50 এখন আমাদের প্রোগ্রামে ফিরে আসি।
03.53 ফাংশনে প্যারামিটারস বা আর্গুমেন্টস নামক বিশেষ চিহ্ন রয়েছে।
04.00 এখন আমরা আর্গুমেন্টের সাথে একই উদাহরণ দেখবো।
04.03 আমি এখানে কয়েকটি জিনিস বদলাবো। আপনার কীবোর্ড Shift, Ctrl এবং S কী একসাথে টিপুন।
04.14 ফাইলটি function.c হিসাবে সংরক্ষণ করুন। save এ টিপুন।
04.24 void শব্দটি int দিয়ে প্রতিস্থাপিত করুন এবং বন্ধনীতে লিখুন int a, int b;
04.34 save এ টিপুন।
04.37 এখানে int a এবং int b হল add ফাংশনের আর্গুমেন্ট।
04.44 এখন এটি মুছে ফেলুন।
04.47 a এবং b এখানে লেখার দরকার নেই। এখন void শব্দটি int দিয়ে আবার প্রতিস্থাপিত করুন এবং save এ টিপুন।
04.58 এখানে একটি ভ্যারিয়েবল সমষ্টি ঘোষিত করা যাক।
05.01 এখন int sum এবং সেমিকোলন লিখুন।
05.05 Enter টিপুন।
05.06 এবং লিখুন sum = add(5,4) এবং শেষে সেমিকোলন লিখুন।
05.19 এখানে এটি আমাদের add ফাংশন।
05.22 তারপর আমরা আর্গুমেন্ট হিসাবে 5 এবং 4 লিখি।
05.26 5 এবং 4 যথাক্রমে a এবং b তে সংরক্ষিত হবে।
05.31 এডিশন অপারেশন সঞ্চালিত করা হবে।
05.34 রিটার্ন ভ্যালু c, sum এ সংরক্ষণ করা হবে।
05.38 এখন এই add মুছে ফেলুন যেহেতু আমরা ইতিমধ্যে উপরের ফাংশন লিখে ফেলেছি।
05.44 এবং লিখুন
05.45 return 0 এবং সেমিকোলন। save এ টিপুন।
05.51 একটি non-void ফাংশনের রিটার্ন স্টেটমেন্ট ব্যবহার করা আবশ্যক যা একটি মান ফেরত দেয়।
05.58 প্রোগ্রাম এক্সিকিউট করি।
06.00 টার্মিনালে ফিরে আসি।
06.03 gcc function.c -o fun লিখুন এবং enter টিপুন।
06.13 এক্সিকিউট করতে লিখুন

./fun এবং enter টিপুন।

06.19 আউটপুট
06.21 The Sum of a & b is 9 হিসাবে প্রদর্শিত হয়েছে।
06.25 এখন আমরা একই প্রোগ্রাম C ++ এ এক্সিকিউট করব।
06.29 প্রোগ্রামে ফিরে আসি। আমি একই কোড এডিট করব, আবার আপনার কীবোর্ড Shift, Ctrl এবং S কী একসাথে টিপুন।
06.41 Now Save the file with an extension .cpp and click on save
06.47 Let us change the header file as iostream
06.52 Now include the using statement. Click on save
07.00 The function declaration is same in C++
07.04 So there is no need to change anything here
07.07 Now replace the printf statement with the cout statement


07.13 Delete the format specifier and \n
07.16 delete the comma
07.17 Type two opening angle brackets. Delete the closing bracket here
07.23 Again type two opening angle brackets
07.25 and within the double quotes type backslash n
07.29 We use the cout function to print the line in C++
07.34 Now Click on save
07.37 Let us exeute the program
07.39 Come back to our terminal
07.42 To compile, type g++ function.cpp -o fun1
07.52 Here we have fun1, because we don't want to overwrite the output parameter fun for the file fun.c .
08.02 Now press Enter
08.05 To execute
08.06 Type./fun1 And press enter
08.12 The output is displayed as:
08.14 The sum of a & b is 9.
08.16 we can see that the output is similar to our c code
08.20 Let us see some common errors which we can come across.
08.24 Come back to our program.
08.26 Suppose here at line no-11 . I will type x in the place of 4.
08.32 I will retain the rest of the code as it is.
08.36 Now click on Save
08.38 Let us execute the program
08.40 Come back to our terminal.
08.44 Let us compile as before
08.48 We see an error
08.50 x was not declared in this scope. come back to our program
08.54 This is because x is a character variable
08.58 And our add function has integer variable as an argument
09.04 So there is a mismatch in return type and return value.
09.08 Now Let us fix the error


09.10 Type 4 here. Click on Save
09.15 Let us execute
09.17 Come back to our terminal. Let me clear the prompt.
09.21 Let us compile as before, execute as before
09.27 Yes! it is working
09.29 now we will see another common error .Come back to our program
09.34 here we will pass only 1 argument
09.39 delete 4
09.40 Now Click on Save .
09.43 Let us see, what happens come back to our terminal.
09.47 Let us compile as before


09.49 We see error too few arguments to few functions int 'add'


09.54 Come back to our program


09.56 You can see here we have two argument int a and int b
10.03 And here we are passing only one argument.
10.06 Hence it is giving an error
10.09 Let us fix the error
10.10 Type 4 ,click on save
10.13 Let us execute again
10.16 Compile as before , execute as before.
10.21 Yes it is working!Now come back to our slide
10.26 Let us summaries ,In this tutorial we learn't
10.29 Functions
10.31 Syntax of function
10.33 Function without arguments: e.g ; void add()
10.37 Function with arguments: e.g ;int add( int a,int b)
10.43 As an assignment
10.45 Write a program to calculate the square of a number using function.
10.50 Watch the video available at http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial
10.53 It summarises the Spoken Tutorial project
10.56 If you do not have good bandwidth, you can download and watch it
11.01 The Spoken Tutorial Project Team
11.03 Conducts workshops using spoken tutorials
11.07 Gives certificates to those who pass an online test
11.11 For more details, please write to contact@spoken-tutorial.org
11.19 Spoken Tutorial Project is a part of the Talk to a Teacher project
11.23 It is supported by the National Mission on Education through ICT, MHRD, Government of India
11.30 More information on this Mission is available at: http://spoken-tutorial.org\NMEICT-Intro
11.35 This is Ashwini Patil from IIT Bombay
11.39 Thank You for joining

Contributors and Content Editors

Kaushik Datta, Pratik kamble, Ranjana