انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

lesson 9

Share |
الكلية كلية العلوم للبنات     القسم قسم الحاسبات     المرحلة 1
أستاذ المادة ماجد جبار جواد الفنهراوي       02/12/2017 19:20:43
Loop control statements are used to execute a statement or a group of statements multiple times. Suppose you want to print a number 10 times. Instead of using 10 cout statements, we can simply loop over a single cout statement 10 times.
A loop inside another loop is called a nested loop. The number of loops depend on the complexity of a problem. Suppose, a loop, outer loop, running n number of times consists of another loop inside it, inner loop, running m number of times. Then, for each execution of the outer loop from 1...n, the inner loop runs maximum of m times.
Every for loop follows this syntax :

for ( initialize; condition; increment / decrement ) {
statement 1;
statement 2;
.
statement n;
}
for loop is known as entry controlled loop since the condition check is done at beginning of the loop. Following program illustrates the use of for loop :
However, it is considered a good practice to use a for loop in situations where the loop is executed a given number of times, as opposed to being executed until something happens.


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم