140 Control Structures: Part 2 Chapter 5 Outline (Web host 4 life)
140 Control Structures: Part 2 Chapter 5 Outline 5.1 Introduction 5.2 Essentials of Counter-Controlled Repetition 5.3 for Repetition Structure 5.4 Examples Using the for Structure 5.5 switch Multiple-Selection Structure 5.6 do/while Repetition Structure 5.7 Statements break and continue 5.8 Logical and Conditional Operators 5.9 Structured-Programming Summary Summary Terminology Self-Review Exercises Answers to Self-Review Exercises Exercises 5.1 Introduction Chapter 4 began our introduction to the types of building blocks that are available for problem solving and used those building blocks to implement proven program-construction principles. In this chapter, we continue our presentation of the theory and principles of structured programming by introducing C# s remaining control structures. As in Chapter 4, the C# techniques you learn here are applicable to most high-level languages. When we begin our formal treatment of object-based programming in C# in Chapter 8, we will see that the control structures we study in this chapter and in Chapter 4 are helpful in building and manipulating objects. 5.2 Essentials of Counter-Controlled Repetition In the last chapter, we introduced the concept of counter-controlled repetition. In this section, we formalize the elements needed in counter-controlled repetition, namely: 1. The name of a control variable (or loop counter), used to determine whether the loop continues. 2. The initial value of the control variable. 3. The increment (or decrement) by which the control variable is modified each time through the loop (also known as each iteration of the loop). 4. The condition that tests for the final value of the control variable (i.e., whether looping should continue). To see the four elements of counter-controlled repetition, consider the simple program in Fig. 5.1, which displays the digits 1 5. The declaration (line 10) int counter = 1; names the control variable (counter), declares it to be an integer, reserves space for it in memory and sets it to an initial value of 1. This statement is a declaration that includes an
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision mysql hosting services