Download presentation
Presentation is loading. Please wait.
1
C++ Programming L4+5 . Functions kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
2
kkkkkkkkkkkkkk عندما نقوم بمعالجة مهمة ما نقوم بتقسيمها إلى مهام جزئية كل مهمة يقوم بتنفيذها تابع ما © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
3
أي تابع بلغة الـ C++ يتألف من قسمين أساسيين :
kkkkkkkkkkkkkk functions : أي تابع بلغة الـ C++ يتألف من قسمين أساسيين : ترويسة التابع function header : وهي توجد في بداية التابع وتتألف من ثلاث أجزاء : Return Type of The Function وهذا الجزء يحدد النمط الذي يرده التابع . Name of The Function وهذا الجزء يحدد اسم التابع . Types and Names of Parameters وهذا الجزء يحدد أسماء وأنماط متحولات دخل التابع. جسم التابع Body : وهذا الجزء هو الذي سيعبر عن وظيفة التابع بحيث يعالج الدخل ويقوم بإعطاء خرج يتوافق مع مهمة التابع المكتوب . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
4
functions : Example kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
5
functions : يوجد طريقتين لكتابة تابع بلغة c++ هما :
kkkkkkkkkkkkkk functions : يوجد طريقتين لكتابة تابع بلغة c++ هما : الطريقة الأولى : باستخدام الـ function prototype . نحتاج إلى function prototype(function declaration) نحتاج طبعاً إلى function definition . الطريقة الثانية : باستخدام كتابة التابع بشكل كامل قبل أماكن استدعاءه. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
6
functions : first way : يوجد طريقتين لكتابة تابع بلغة c++ هما :
kkkkkkkkkkkkkk functions : first way : يوجد طريقتين لكتابة تابع بلغة c++ هما : الطريقة الأولى : باستخدام الـ function prototype . يسمى الشكل السابق بـ prototype أو declaration للتابع ، وينتهي بفاصلة منقوطة. يتم وضعه في الـ global section قبل أماكن الاستدعاء ولمرة واحدة . ومن بعدها يتم وضع الـتابع بشكل كامل function definition في أي مكان يلي الـ prototype . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
7
functions : first way : prototype calling Header + body kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
8
kkkkkkkkkkkkkk functions : first way : وهذه الطريقة صحيحة أيضاً إذ أننا نقوم باخبار المترجم في سطر الـ prototype أنه لدينا تابع اسمه add يأخذ متحولين كلاهما من النمط int (لا يهمني اسمهم هنا طالما لا يتم استخدامهما أي لا يوجد جسم للتابع). نهتم باسماء المتحول عند كتابة الـ function definition. prototype calling Header + body © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
9
functions : first way : هنا سيرى المترجم استدعاء تابع غير معرف عنده .
kkkkkkkkkkkkkk functions : first way : هنا سيرى المترجم استدعاء تابع غير معرف عنده . calling Header + body © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
10
kkkkkkkkkkkkkk functions : first way : إذاً في هذه الطريقة يتم في البداية تعريف الـ prototype للتابع ونضعه في الأعلى فوق الـ main حتى يتم رؤيته من جميع التوابع الأخرى . ثم يتم تعريف كامل التابع function definition (الترويسة + جسم التابع) في أي مكان يلي الـ prototype . prototype calling Header + body © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
11
functions : second way :
kkkkkkkkkkkkkk functions : second way : يوجد طريقتين لكتابة تابع بلغة c++ هما : الطريقة الثانية: باستخدام الطريقة المألوفة . يتم وضع الـتابع بشكل كامل function definition في أي مكان ضمن الـ global section وقبل مكان الاستدعاء ، كي يتم رؤيته . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
12
functions : second way :
kkkkkkkkkkkkkk functions : second way : يتم وضع الـتابع بشكل كامل في أي مكان ضمن الـ global section وقبل مكان الاستدعاء ، كي يتم رؤيته . Header + body calling © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
13
functions : Function Signature !
kkkkkkkkkkkkkk functions : Function Signature ! الـ function signature هو جزء من الـ function prototype الذي يتألف من اسم التابع وأنماط الـ parameters list من دون نمط الإرجاع . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
14
functions : Function definition
kkkkkkkkkkkkkk functions : Function definition Parameters List : يتم الفصل بين المتحولات بفاصلة . المتحولات هي local variables أي تموت هذه المتحولات بعد الخروج من التابع . لا يمكن تعريف متحول داخل التابع بنفس اسم متحول دخل للتابع . لكتابة تابع بدون متحولات إما نترك الـ parameter list فارغة أو نكتب الكلمة void لتدل على لا شيء. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
15
functions : Function definition
kkkkkkkkkkkkkk functions : Function definition Function name : يتم وضع اسم للتابع بحيث يعبر عن وظيفته . يجب أن يكون اسم التابع غير محجوز مسبقاً . لا يمكن تعريف تابع ضمن تابع آخر ! يمكن استدعاء تابع ضمن تابع آخر . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
16
kkkkkkkkkkkkkk functions :Example عندما يتم تمرير قيمة متحول لتابع فإنه يتم في البداية أخذ نسخة من هذا المتحول وتعطى كدخل للتابع وبالتالي يتم المحافظة على القيمة السابقة كي لا يتم تغييرها من داخل التابع. هنا تم نسخ المتحول x في التابع f1 وإعطاء النسخة كدخل للتابع f2 فأي تعديل على x داخل f2 لن يعدل على x في f1 لأنها نسخة منها وليست هي نفسها ! 10 5 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
17
functions :Math Library
kkkkkkkkkkkkkk functions :Math Library يوجد مكتبة تحوي مجموعة من التوابع الرياضية وتدعى cmath . نقوم بتضمين المكتبة السابقة في برنامجنا لنتمكن من استدعاء التوابع الموجودة بداخلها . #include <cmath> أغلب التوابع الموجودة في المكتبة السابقة يكون دخلها من النمط double والخرج أيضاً double . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
18
functions :Math Library
kkkkkkkkkkkkkk functions :Math Library © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
19
functions :Math Library
kkkkkkkkkkkkkk functions :Math Library © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
20
functions :Generating Random Numbers
kkkkkkkkkkkkkk functions :Generating Random Numbers يوجد تابع يدعى rand( ) يقوم بتوليد أعداد عشوائية ضمن المجال [ ] . التابع السابق يوجد ضمن المكتبة <cstdlib> . كل مرة يتم توليد رقم جديد ضمن المجال السابق وفق استراتيجية ما بدءاً من قيمة ما تدعى البذرة seed . ستنتج نفس القيم المولدة عند إعادة تنفيذ البرنامج من جديد ! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
21
functions :Generating Random Numbers
kkkkkkkkkkkkkk functions :Generating Random Numbers يوجد تابع يدعى srand(unsigned int ) والذي يقوم بتعيين القيمة الأولية للأعداد المولدة عشوائية أي تحديد قيمة البذرة seed . التابع السابق أيضاً يوجد ضمن المكتبة <cstdlib> . في حال كانت القيمة المدخلة ثابتة فإنه سيتم توليد كل مرة تنفيذ نفس سلسلة الأرقام المولدة . التابع السابق يتم استدعاءه لمرة واحدة فقط . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
22
functions :Generating Random Numbers
kkkkkkkkkkkkkk functions :Generating Random Numbers إذاً ماذا نفعل إذا كنا نريد في كل مرة تنفيذ توليد قيم مختلفة ؟ في كل مرة نقوم بإدخال قيمة مختلفة كدخل للتابع srand( unsigned int ) . مثلاً ندخل الوقت الحالي بالثواني !!! يوجد تابع يقوم بذلك يدعى time(0) وهو ضمن المكتبة <ctime> . في كل مرة نقوم فيها بتنفيذ البرنامج ستنتج لدينا قيم عشوائية مختلفة بسبب اختلاف قيمة البذرة . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
23
functions :Generating Random Numbers
kkkkkkkkkkkkkk functions :Generating Random Numbers ذكرنا أن التابع rand( ) يقوم بتوليد قيمة عشوائية ضمن المجال [ ] . ولكن ماذا سنفعل إذا كنا نريد توليد قيمة ضمن المجال [start end] مثلا توليد قيمة ضمن المجال [ ] . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
24
functions :Generating Random Numbers
kkkkkkkkkkkkkk functions :Generating Random Numbers ذكرنا أن التابع rand( ) يقوم بتوليد قيمة عشوائية ضمن المجال [ ] . ولكن ماذا سنفعل إذا كنا نريد توليد قيمة ضمن المجال [start end] مثلا توليد قيمة ضمن المجال [ ] . سنقوم بالبداية بإجراء عملية باقي القسمة % لأن x % y سيعطينا قيمة ضمن المجال [ y-1] ثم نقوم بعملية إزاحة بقيمة ما ليتم إزاحة كامل المجال . !! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
25
functions :Generating Random Numbers
kkkkkkkkkkkkkk functions :Generating Random Numbers مثلا توليد قيمتين ضمن المجال [ ] وبحيث كل مرة يتم فيها تنفيذ البرنامج يتم توليد قيم مختلفة عن القيم السابقة . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
26
kkkkkkkkkkkkkk Header Files : أحياناً نقوم بكتابة عدة ملفات تحوي عدد كبير من التوابع لماذا لا نقوم بفرز هذه التوابع بشكل منطقي وفقاً لوظيفتها ، مثلاً التوابع الرياضية نقوم بوضعها لوحدها (في ملف منفصل)، والتوابع المسؤولة عن تصميم الواجهات في مكان آخر ، وهكذا (هذه الأجزاء هي عبارة عن ملفات منفصلة تدعى مكاتب) هذا الأمر يساعدنا أيضاً في إعادة استخدام هذه الأجزاء المنفصلة في أكثر من مشروع . سابقاً كنا نقوم باستخدام مكاتب جاهزة في اللغة ولتضمينها نكتب : ولكن ماذا لو كنا نريد كتابة مكتبة خاصة بنا !!! سنقوم الآن بكتابة مكتبة رياضية بسيطة خاصة بنا تحوي تابع وحيد الآن يقوم بجمع عددين .... © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
27
kkkkkkkkkkkkkk Header Files : نقوم بإنشاء ملف header نسميه باسم المكتبة الذي نريد مثلاً my_math ونضعه ضمن مجلد الـ header في الـ project الحالي . تكون لاحقة المكتبة .h لأنه سيكون ملف header . نقوم بكتابة header التوابع التي نريد فقط الترويسة أي prototype من دون كتابة جسم التابع في ملف الـ header ، كما يمكننا أيضاً تعريف متحولات إذا أردنا . نقوم بكتابة أجسام التوابع كاملة في ملف جديد بالاسم my_math.cpp سيتضمن كود تحقيق تلك التوابع الموجودة في الـ header file ، إذاً سيتم وضع ملف جديد بالاسم السابق ضمن الـ source . الآن بقي لنا تضمين مكتبتنا الجديدة لنقوم باستخدامها . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
28
Header Files : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
29
kkkkkkkkkkkkkk Header Files : الآن نقوم بتضمين مكتبتنا في الملف الأساسي حتى نتمكن من استخدام توابعنا الجديدة . Compiler Error عملية التضمن #include < …> تستخدم للمكاتب التي أتت مع اللغة وتكون موجودة في مكان خاص في القرص الصلب. ويكون التضمين لمكاتبنا الجديدة باستخدام #include “filename.h” © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
30
kkkkkkkkkkkkkk Header Files : الآن نقوم بتضمين مكتبتنا في الملف الأساسي حتى نتمكن من استخدام توابعنا الجديدة . 8.2 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
31
Header Files : إذاً أصبح لدينا ثلاث ملفات الآن : الأول :
kkkkkkkkkkkkkk Header Files : إذاً أصبح لدينا ثلاث ملفات الآن : الأول : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
32
Header Files : إذاً أصبح لدينا ثلاث ملفات الآن : الثاني:
kkkkkkkkkkkkkk Header Files : إذاً أصبح لدينا ثلاث ملفات الآن : الثاني: © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
33
Header Files : إذاً أصبح لدينا ثلاث ملفات الآن : الثالث:
kkkkkkkkkkkkkk Header Files : إذاً أصبح لدينا ثلاث ملفات الآن : الثالث: © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
34
Scope Rules : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
35
Scope Rules :Local Scope :
kkkkkkkkkkkkkk Scope Rules :Local Scope : النطاق المحلي local scope هو أي نطاق يبدأ بـ { وينتهي ب } . {………………………………………..} . جسم التابع يوجد ضمن نطاق ، والـ switch body أيضاً هو نطاق ، ..... يمكن تعريف نطاق بداخل نطاق . جميع المتحولات التي يتم تعريفها ضمن نطاق ما تكون فترة حياتها ضمن هذا النطاق أي أنها تموت بعد الخروج من هذا النطاق . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
36
Scope Rules :Local Scope :
kkkkkkkkkkkkkk Scope Rules :Local Scope : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
37
Scope Rules :Local Scope :
kkkkkkkkkkkkkk Scope Rules :Local Scope : Compiler Error © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
38
Scope Rules :Global Scope :
kkkkkkkkkkkkkk Scope Rules :Global Scope : المجال الذي لا يقع ضمن أي block هو نطاق عام global block . فترة حياة المتحولات ضمن الـ global scope (file scope) هي بانتهاء تنفيذ البرنامج. تمكننا الـ global variable من سهولة الوصول إليها أينما كنا . ولكن ينبغي تجنبها إذ أنه في حال جعلنا جميع المتحولات لدينا هي global سيصبح هنا عدد هائل من المتحولات وعدم التمييز بينها لاحقاً ، مما يصعّب من صيانة البرنامج في حال أردنا تعديله . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
39
Scope Rules :Global Scope :
kkkkkkkkkkkkkk Scope Rules :Global Scope : Global variable Local variable in main Local variable in scope inside main © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
40
Scope Rules :Static storage :
kkkkkkkkkkkkkk Scope Rules :Static storage : يمكن تعريف متحول ما على أنه static . يمكن تعريف متحول ساكن محلي static local ضمن تابع مثلاً ، عندها فإن هذا المتحول يتم تهيئته لمرة واحدة فقط (بحيث يصبح ساكن ضمن التابع) وتكون فترة حياته بانتهاء البرنامج ولكن لا تتم رؤيته إلا من داخل التابع . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
41
Scope Rules :Static storage :
kkkkkkkkkkkkkk Scope Rules :Static storage : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
42
Scope Rules : scope resoultion operator ::
kkkkkkkkkkkkkk Scope Rules : scope resoultion operator :: لدينا متحول عام global variable ولكننا حتى الآن لم نصل إليه !!!! كيف سنطبع قيمة الـ x العامة ؟!! عن طريق المعامل :: والذي يتم وضعه قبل اسم المتحول والذي يقصد به الخروج إلى الـ global scope ثم انتقاء المتحول . انتقل للمثال التالي .... 9 1 8 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
43
Scope Rules : scope resoultion operator ::
kkkkkkkkkkkkkk Scope Rules : scope resoultion operator :: © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
44
kkkkkkkkkkkkkk Recursion ! التوابع العودية هي توابع يتم تنفيذها مرة واحدة أو أكثر ويتم الخروج منها عند عدم تحقق شرط ما يدعى شرط التوقف . التابع العودي هو تابع يقوم باستدعاء نفسه كل مرة إلى أن يصل إلى شرط التوقف فيتوقف عن الاستدعاء ويقوم بتحصيل النتائج المتراكمة عن الاستدعاءات السابقة . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
45
Recursion ! هذا مثال يقوم بإيجاد عاملي لعدد ما ولكن بشكل تكراري وليس عودي .
46
kkkkkkkkkkkkkk Recursion ! هذا مثال يقوم بإيجاد عاملي لعدد ما ولكن بشكل تكراري وليس عودي . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
47
kkkkkkkkkkkkkk Recursion ! يمكننا كتابة المهمة السابقة عن طريق تابع عودي بالاستناد إلى العلاقة التالية : نقوم بالتوقف عن العودية عندما يصبح العدد المدخل للتابع هو 0 . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
48
Recursion ! إذاً لدينا قاعدتين : الحالة الخاصة (شرط التوقف)
kkkkkkkkkkkkkk Recursion ! إذاً لدينا قاعدتين : الحالة الخاصة (شرط التوقف) الحالة العامة (الحالة التي يحصل فيها استدعاء عودي للتابع نفسه) © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
49
Recursion ! هذا مثال يقوم بإيجاد عاملي لعدد ما ولكن بشكل عودي .
50
kkkkkkkkkkkkkk Recursion ! كل عملية استدعاء لتابع تكون له متحولاته الخاصة والمستقلة عن الاستدعاء السابق . يجب تنفيذ جميع التعليمات الموجودة في الاستدعاء العودي الحالي . انتقل للمثال التالي والذي يشرح كامل الفكرة !! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
51
Recursion ! kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
52
inline function : هي تقنية لتسريع الأداء من قبل المترجم .
kkkkkkkkkkkkkk inline function : هي تقنية لتسريع الأداء من قبل المترجم . نقوم بوضع الكلمة المفتاحية inline قبل تعريف التابع . يتم إبلاغ المترجم بأن يقوم بنقل جسم التابع عوضاً عن أماكن الاستدعاء . يوفر لنا كلفة عمليات استدعاء التوابع ، نسخ متحولات ، عملية إرجاع القيم من التابع ، ..... من الأفضل أن يكون التابع يحوي عدد قليل جداً من التعليمات . انتقل للمثال التالي ..... © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
53
kkkkkkkkkkkkkk inline function : إذاً سيتم استبدال استدعاء التابع بمجموعة التعليمات الموجودة في جسم التابع . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
54
Call by value vs Call by reference :
kkkkkkkkkkkkkk Call by value vs Call by reference : يوجد لدينا نوعين من تمرير المتحولات لتابع ما : التمرير بالقيمة by value . التمرير بالعنوان by reference . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
55
Call by value vs Call by reference :
kkkkkkkkkkkkkk Call by value vs Call by reference : يوجد لدينا نوعين من تمرير المتحولات لتابع ما : التمرير بالقيمة by value . يتم أخذ نسخة من المتحولات ثم يتم إدخال النسخ الجديدة للتابع . أي تعديل على المتحولات داخل التابع سيجعل التعديل فقط داخله من دون أن ينعكس على المتحول الأصلي . انتقل للمثال التالي : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
56
Call by value vs Call by reference :
kkkkkkkkkkkkkk Call by value vs Call by reference : يوجد لدينا نوعين من تمرير المتحولات لتابع ما : التمرير بالقيمة by value . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
57
Call by value vs Call by reference :
kkkkkkkkkkkkkk Call by value vs Call by reference : يوجد لدينا نوعين من تمرير المتحولات لتابع ما : التمرير بالعنوان by reference. يقوم التابع باستخدام المتحول الأصلي من دون أخذ نسخة عنه. أي تعديل على المتحول داخل التابع سيحافظ على هذا التغيير عند الخروج منه. يتم استخدامه عن طريق وضع الرمز & بعد النمط في الـ parameter list . انتقل للمثال التالي : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
58
Call by value vs Call by reference :
kkkkkkkkkkkkkk Call by value vs Call by reference : يوجد لدينا نوعين من تمرير المتحولات لتابع ما : التمرير بالعنوان by reference. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
59
kkkkkkkkkkkkkk Default Arguments : يمكن وضع قيم افتراضية لمتحولات دخل التابع في حال عدم إدخالها !! يمكن أن تكون هذه القيم الافتراضية : قيمة ثابتة . استدعاء تابع . متحول عام . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
60
kkkkkkkkkkkkkk Default Arguments : في الاستدعاء add(4) مثلاً سيتم وضع القيمة 4 في المتحول x ، وبما أنه انتهت قيم الدخل عند الاستدعاء فإن باقي القيم ستؤخذ افتراضياً من ترويسة التابع . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
61
Function Overloading :
kkkkkkkkkkkkkk Function Overloading : يمكننا إجراء ما يسمى بالتحميل الزائد للتوابع أي صنع أكثر من تابع مشتركين بنفس الاسم ومختلفين بالـ parameter list سواء بأنماط متحولات الدخل أو بترتيبهم أو بعددهم . نقوم بالعمل على جزء الـ signature (اسم التابع + متحولات الدخل) نقوم بالمحافظة على اسم التابع . يمكننا تغيير الـ parameter list كما نشاء . يجب أن يبقى نمط الإرجاع للتابع كما هو ! انتقل للأمثلة التالية حتى يتم إيضاح الفكرة بشكل أكبر . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
62
Function Overloading :
kkkkkkkkkkkkkk Function Overloading : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
63
Function Overloading :
kkkkkkkkkkkkkk Function Overloading : إذاً تمكنا من استدعاء التابع print بأكثر من طريقة . عندها يمكننا القول أنه لدينا overloading للتابع print . يجب أن يكون هنالك تطابق باسم التابع واختلاف في الـ parameters list لهذه التوابع سواء في : نمط المتحولات . اختلاف ترتيب المتحولات . عدد المتحولات . أحياناً قد نخطئ في عملية الـ overloading مما يجعل المترجم أمام أكثر من تابع يمكن أن يناسبان الاستدعاء ، عندها سينتج لدينا compiler error . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
64
Function Overloading :
kkkkkkkkkkkkkk Function Overloading : **سلسلة المحارف لا تقصر لاي نمط والعكس صحيح يتم القصر بين جميع الانماط الاخرى** بالتحميل الزائد يكون نمط الارجاع نفسه** **عندما يكون لدينا تابعين يأخذان باراميتير واحد احدهما انتيجير والاخر فلوت وعند استدعائهما فيحصل كومبايلر ايرور مع العم ان هذا الايرور لا يحدث عندما يكون احدهما دبل © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
65
Macro in c++ google it kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
66
kkkkkkkkkkkkkk Task Do it now !: كيف يمكننا إيجاد العنصر الأكبر بين عنصرين أياً كانا هذان العنصران . أي لدينا مثلاً متحولين int ونريد إيجاد الأكبر بينهما . وأيضاً لدينا متحولين double ونريد إيجاد الأكبر بينهما . وأيضاً لدينا محرفين char ونريد إيجاد الأكبر بينهما . وهكذا ما هي الخيارات التي لدينا ! كتابة عدة توابع بأسماء مختلفة إجراء overloading functionـ إنها عملية تحتاج إلى وقت وجهد.... انتقل للفكرة التالية لنرى أحد الحلول المقترحة © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
67
kkkkkkkkkkkkkk Function templates : هو نوع خاص من التوابع يمكنه معالجة أنماط عامة generic types . نقوم بإنشاء function template يمكنه أن يتكيف مع أكثر من نمط مما يسهل علينا عملية تكرار التوابع . يمكننا تعريف القالب بإحدى الطريقتين : © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
68
kkkkkkkkkkkkkk Function templates : هو نوع خاص من التوابع يمكنه معالجة أنماط عامة generic types . نقوم بإنشاء function template يمكنه أن يتكيف مع أكثر من نمط مما يسهل علينا عملية تكرار التوابع . لا يوجد فاصلة منقوطة في السطر الأول************************************ © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
69
kkkkkkkkkkkkkk Function templates : يقوم المترجم بمعرفة النمط بشكل ضمني من خلال أنماط المتحولات المدخلة أثناء الاستدعاء فإذا أدخلنا متحولات من النمط int فإنه سيتم توليد تابع يتعامل مع االنمط int حيث يصبح mytype هو int . هنا سيتم توليد ثلاث توابع بشكل تلقائي وضمني. جميع الباراميتيرز من نمط واحد في كل استدعاء** © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
70
kkkkkkkkkkkkkk Function templates : يقوم المترجم بمعرفة النمط بشكل صريح لأننا هنا قمنا بإدخاله صراحةً بين اسم التابع والـ parameters list بالشكل <type> ففي السطر الأول من التابع main تم تمرير القيمتين 4 و 7 على التتالي للتابع المشكل عن طريق القالب حيث mytype = int تم إدخالها بشكل صريح . عند التنفيذ سنحصل على نفس الخرج السابق . اذا كان نمط الباراميترز مختلف عن النمط فيحدث قصر تلقائي********************************** © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
71
Function templates : example
kkkkkkkkkkkkkk Function templates : example © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
72
Function templates : Task
kkkkkkkkkkkkkk Function templates : Task لنقم بكتابة تابع يقوم بالتبديل بين شيئين . سنبدأ بالطريقة التقليدية عن طريق كتابة مجموعة من التوابع بنفس الاسم ويكون الاختلاف بأنماط متحولات الدخل (overloading) مع ملاحظة أنه هنا سيكون التمرير بالـعنوان! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
73
Function templates : Task
kkkkkkkkkkkkkk Function templates : Task لنقم بكتابة تابع يقوم بالتبديل بين شيئين . أما عن طريق الـ function Template تكون المهمة أسهل ... © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
74
Function templates : يمكن للقالب أن يأخذ أكثر من نمط generic .
kkkkkkkkkkkkkk Function templates : يمكن للقالب أن يأخذ أكثر من نمط generic . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
75
Function templates : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
76
Function templates : prototype !
kkkkkkkkkkkkkk Function templates : prototype ! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
77
Example (1) : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
78
Example (2) : الاستدعاءات الثلاثة خاطئة :
kkkkkkkkkkkkkk Example (2) : الاستدعاءات الثلاثة خاطئة : لأنه عند الاستدعاءات الثلاثة ستحصل عملية تطابق للتابعين ، عندها المترجم سيكون له خيارين ويقع في حيرة من أمره ! عندها سيقوم برفض هذه الاستدعاءات وينتج لدينا compiler error . إذاً يجب الانتباه عند استخدام الـ overloading للتوابع . تنفيذ******************* © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
79
kkkkkkkkkkkkkk Example (3) : a هو متحول يتم تمريره بالعنوان إذاً عند الاستدعاء تدخل النسخة الأصلية للتابع فإذا تعدلت فإن التعديل سيؤخذ بعين الاعتبار بعد الخروج من التابع . b هو متحول يتم تمريره بالقيمة إذاً يتم أخذ نسخة منه وتمريرها للتابع وأي تعديل على النسخة لن يؤثر على النسخة الأصلية . 1 4 6 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
80
Example (4) : 10 kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
81
Example (5) : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
82
Example (6) : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
83
Example (7) : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
84
Example (8) : kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
85
اكتب برنامج يحوي ثلاث توابع موجودين ضمن مكتبة من صنعك :
kkkkkkkkkkkkkk اكتب برنامج يحوي ثلاث توابع موجودين ضمن مكتبة من صنعك : التابع الأول يقوم بعملية جمع الأعداد من 1 إلى n حيث n قيمة مدخلة للتابع بطريقة تكرارية (حلقة) التابع الثاني يقوم بعملية جمع الأعداد من 1 إلى n حيث n قيمة مدخلة للتابع بطريقة عودية التابع الثالث يقوم بعملية جمع الأعداد من 1 إلى n حيث n قيمة مدخلة للتابع بطريقة (ليست عودية وليست تكرارية) أي تعليمات فقط من دون أن يكون هناك أي تكرار أو عودية © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
86
متى نستخدم العودية ومتى نستخدم التكرارية !! ما الفرق بينهما ؟؟
kkkkkkkkkkkkkk متى نستخدم العودية ومتى نستخدم التكرارية !! ما الفرق بينهما ؟؟ Google it ….. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
87
The End kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.