tailieunhanh - Lesson 3: Control Statements - Selection

This lesson teaches you how to use C# Selection Control Statements. | Tutorial Page 1 of 7 Using Excellent Tools to Write Web Applications Tar the .NET Common Language Runtime CLR Home Up Lesson01 Lesson02 Lesson03 Lesson04 Les Lesson06 Lesson07 Lesson08 Lesson09 Lesson10 Les Lesson12 Lesson13 The C Station Tutorial by Joe Mayo 9 2 00 updated 10 6 01 Lesson 3 Control Statements - Selection On sale Now C Unleashed is an indepth guide for intermediate to advanced software developers to learn the C programming language and serve as a desktop reference. This lesson teaches you how to use C Selection Control Statements. Its goal is to meet the following objectives Learn the if statements. Learn the switch statement. Learn how break is used in switch statements. Understand proper use of the goto statement. In the last couple of lessons every program you saw contained a limited amount of sequential steps and then stopped. There were no decisions you could make with the input and the only constraint was to follow straight through to the end. The information in this lesson will help you branch into separate logical sequences based on decisions you make. Our first selection statement is the if statement. It has three primary forms a single decision an either or decision and multi-case decision. Listing 3-1. Forms of the IF statement using System class IfSelect public static void Main string myInput int myInt Please enter a number myInput myInt myInput Single Decision and Action with brackets http Tutorials 6 24 2002 Tutorial Page 2 of 7 if myInt 0 Your number 0 is greater than zero. myInt Single Decision and Action without brackets if myInt 0 Your number 0 is less than zero. myInt Either Or Decision if myInt 0 Your number 0 is not equal to zero. myInt else Your number 0 is equal to zero. myInt Multiple Case Decision if myInt 0 myInt 0 Your number 0 is less than

TỪ KHÓA LIÊN QUAN