วันอังคารที่ 7 กันยายน พ.ศ. 2553
the three basic programming control structures
A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done by our program, when and under which circumstances.
Conditional structure
In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language which perform different computations or actions depending on whether a programmer-specified "condition" evaluates to true or false (see boolean datatype). Apart from the case of branch predication, this is always achieved by selectively altering the control flow based on some condition.
Iteration structures (loops)
An iteration structure, or loop, is used when you want a block of code to run more than once. For instance, let's say we want the ball from the previous examples to bounce up and down exactly ten times.
Jump Statements
Jump statements can be used to modify the behavior of conditional and iterative statements. Jump statements allow you to exit a loop, start the next iteration of a loop, or explicitly transfer program control to a specified location in your program.
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น