C# and Algorithmic Thinking for the Complete Beginner (2nd Edition): Learn to Think Like a Programmer by Aristides S Bouras

C# and Algorithmic Thinking for the Complete Beginner (2nd Edition): Learn to Think Like a Programmer by Aristides S Bouras

Author:Aristides S Bouras [Bouras, Aristides S]
Language: eng
Format: azw3
Published: 2019-12-15T16:00:00+00:00


found = true;

break;

}

}

if (found) {

Console.WriteLine("Hidden password is: " + password);

}

The statement if (found) is equivalent to the statement if (found == true).

Second Approach – Using a flag

The break statement doesn't actually exist in all computer languages; and since this book's intent is to teach you “Algorithmic Thinking” (and not just special statements that only C# supports), let's look at an alternate approach.

In the following C# program, when the hidden password is found, the Boolean expression found == false forces the flow of execution to exit the loop.

found = false;

i = 100;

while (i <= 999 && found == false) {

if (i == hidden_password) {

password = i;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.