PK ‘}UL 01-GotoLabelsAndSwitch/PK dIUJTò¶h½ ½ ! 01-GotoLabelsAndSwitch/App.config
PK dIUJ¾BçŠ
Š
1 01-GotoLabelsAndSwitch/GotoLabelsAndSwitch.csproj
Debug
AnyCPU
{1587A730-65A0-413D-90C4-73441C37A06D}
Exe
Properties
GotoLabelsAndSwitch
GotoLabelsAndSwitch
v4.5.2
512
true
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
PK eIUJZÕì ì . 01-GotoLabelsAndSwitch/GotoLabelsAndSwitch.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GotoLabelsAndSwitch", "GotoLabelsAndSwitch.csproj", "{1587A730-65A0-413D-90C4-73441C37A06D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1587A730-65A0-413D-90C4-73441C37A06D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1587A730-65A0-413D-90C4-73441C37A06D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1587A730-65A0-413D-90C4-73441C37A06D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1587A730-65A0-413D-90C4-73441C37A06D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
PK SUJêã ! 01-GotoLabelsAndSwitch/Program.csusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GotoLabelsAndSwitch {
class Program {
static void Main(string[] args) {
for (int y = 0; y < 5; y++) {
for (int x = 5; x > 0; x--) {
Console.Write($"y:{y},x:{x} ");
if (x == y) break;
}
Console.WriteLine();
}
Console.WriteLine();
//
//
for (int y = 0; y < 5; y++) {
for (int x = 5; x > 0; x--) {
Console.Write($"y:{y},x:{x} ");
if (x == y) goto AfterYLoop;
}
Console.WriteLine();
}
AfterYLoop:
Console.WriteLine();
//
//
Console.Write("Press ENTER to continue ...");
Console.ReadLine();
Console.WriteLine();
{
string ops = "PCPPCCPX";
int current = 0;
char op;
Locked:
op = ops[current++];
if (op == 'P') {
Console.WriteLine("Push -> BLOCKED");
goto Locked;
} else if (op == 'C') {
Console.WriteLine("Coin -> unlocking");
goto Unlocked;
} else {
Console.WriteLine("UNKNOWN OPERATION");
goto Shutdown;
}
Unlocked:
op = ops[current++];
if (op == 'P') {
Console.WriteLine("Push -> PERSON ENTERED -> locking");
goto Locked;
} else if (op == 'C') {
Console.WriteLine("Coin -> coin wasted, still unlocked");
goto Unlocked;
} else {
Console.WriteLine("UNKNOWN OPERATION");
goto Shutdown;
}
Shutdown:
Console.WriteLine("Shutting down.");
}
Console.WriteLine();
Console.Write("Press ENTER to continue ...");
Console.ReadLine();
Console.WriteLine();
{
string ops = "PCPPCCPX";
int current = 0;
char op;
State state = State.Locked;
switch (state) {
case State.Locked:
op = ops[current++];
if (op == 'P') {
Console.WriteLine($"{state} Push -> BLOCKED");
goto case State.Locked;
} else if (op == 'C') {
Console.WriteLine($"{state} Coin -> unlocking");
goto case State.Unlocked;
} else {
Console.WriteLine($"{state} UNKNOWN OPERATION");
goto case State.Shutdown;
}
case State.Unlocked:
op = ops[current++];
if (op == 'P') {
Console.WriteLine($"{state} Push -> PERSON ENTERED -> locking");
goto case State.Locked;
} else if (op == 'C') {
Console.WriteLine($"{state} Coin -> coin wasted, still unlocked");
goto case State.Unlocked;
} else {
Console.WriteLine($"{state} UNKNOWN OPERATION");
goto case State.Shutdown;
}
case State.Shutdown:
Console.WriteLine($"{state} Shutting down.");
break;
}
}
}
enum State { Locked, Unlocked, Shutdown };
}
}
PK ‘}UL " 01-GotoLabelsAndSwitch/Properties/PK dIUJ§ú[èª ª 1 01-GotoLabelsAndSwitch/Properties/AssemblyInfo.csusing System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GotoLabelsAndSwitch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GotoLabelsAndSwitch")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1587a730-65a0-413d-90c4-73441c37a06d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
PK ‘}UL 01-GotoLabelsAndSwitch/PK dIUJTò¶h½ ½ ! 5 01-GotoLabelsAndSwitch/App.configPK dIUJ¾BçŠ
Š
1 1 01-GotoLabelsAndSwitch/GotoLabelsAndSwitch.csprojPK eIUJZÕì ì .
01-GotoLabelsAndSwitch/GotoLabelsAndSwitch.slnPK SUJêã ! B 01-GotoLabelsAndSwitch/Program.csPK ‘}UL " 01-GotoLabelsAndSwitch/Properties/PK dIUJ§ú[èª ª 1 Ï 01-GotoLabelsAndSwitch/Properties/AssemblyInfo.csPK M È!