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

Lecture 5 - Decision Structures_1

الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 1
أستاذ المادة نوفل تركي عبيس الجميلي       04/01/2017 20:47:17
Making Decisions in a Program
All of the procedures in an application are written using one or more of three basic control
structures: sequence, selection, and repetition. The procedures in the previous three chapters
used the sequence structure only. When one of the procedures was invoked during run
time, the computer processed its instructions sequentially—in other words, in the order the
instructions appeared in the procedure. Every procedure you write will contain the sequence
structure.
Many times, however, a procedure will need the computer to make a decision before selecting
the next instruction to process. A procedure that calculates an employee’s gross pay, for
example, typically has the computer determine whether the number of hours an employee
worked is greater than 40. The computer then would select either an instruction that computes
regular pay only or an instruction that computes regular pay plus overtime pay. Procedures that
need the computer to make a decision require the use of the selection structure (also called the
decision structure).
The selection structure indicates that a decision (based on some condition) needs to be made,
followed by an appropriate action derived from that decision. But how does a programmer
determine whether a problem’s solution requires a selection structure? The answer is by
studying the problem specification.
The first problem specification you will examine in this lesson involves an evil scientist named
Dr. N. The problem specification and an illustration of the problem are shown in Figure 4-4
along with a solution to the problem. The solution, which is written in pseudocode, requires
only the sequence structure.

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