-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathProgram.cs
88 lines (82 loc) · 2.62 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
(char Letter, string CodeWord)[] array = new[]
{
( 'A', "Alpha" ), ( 'B', "Bravo" ), ( 'C', "Charlie" ), ( 'D', "Delta" ),
( 'E', "Echo" ), ( 'F', "Foxtrot" ), ( 'G', "Golf" ), ( 'H', "Hotel" ),
( 'I', "India" ), ( 'J', "Juliett" ), ( 'K', "Kilo" ), ( 'L', "Lima" ),
( 'M', "Mike" ), ( 'N', "November" ), ( 'O', "Oscar" ), ( 'P', "Papa" ),
( 'Q', "Quebec" ), ( 'R', "Romeo" ), ( 'S', "Sierra" ), ( 'T', "Tango" ),
( 'U', "Uniform" ), ( 'V', "Victor" ), ( 'W', "Whiskey" ), ( 'X', "X-ray" ),
( 'Y', "Yankee" ), ( 'Z', "Zulu" ),
};
while (true)
{
Console.Clear();
Console.Write("""
Flash Cards
In this game you will be doing flash card exercises
to help you memorize the NATO phonetic alphabet. The
NATO phonetic alphabet is commonly used during radio
communication in aviation. Each flash card will have
a letter from the English alphabet and you need to
provide the corresponding code word for that letter.
| NATO phonetic alphabet code words
|
| A -> Alpha B -> Bravo C -> Charlie D -> Delta
| E -> Echo F -> Foxtrot G -> Golf H -> Hotel
| I -> India J -> Juliett K -> Kilo L -> Lima
| M -> Mike N -> November O -> Oscar P -> Papa
| Q -> Quebec R -> Romeo S -> Sierra T -> Tango
| U -> Uniform V -> Victor W -> Whiskey X -> X-ray
| Y -> Yankee Z -> Zulu");
Press [enter] to continue or [escape] to quit...
""");
while (true)
{
ConsoleKey key = Console.ReadKey(true).Key;
if (key is ConsoleKey.Enter)
{
break;
}
if (key is ConsoleKey.Escape)
{
Console.Clear();
Console.WriteLine("Flash Cards was closed.");
return;
}
}
bool returnToMainMenu = false;
while (!returnToMainMenu)
{
int index = Random.Shared.Next(array.Length);
Console.Clear();
Console.WriteLine();
Console.WriteLine(" What is the NATO phonetic alphabet code word for...");
Console.WriteLine();
Console.Write($" {array[index].Letter}? ");
string input = Console.ReadLine()!;
Console.WriteLine();
if (input.Trim().Equals(array[index].CodeWord, StringComparison.CurrentCultureIgnoreCase))
{
Console.WriteLine(" Correct! :)");
}
else
{
Console.WriteLine($" Incorrect. :( {array[index].Letter} -> {array[index].CodeWord}");
}
Console.Write(" Press [enter] to continue or [escape] to return to main menu...");
while (true)
{
ConsoleKey key = Console.ReadKey(true).Key;
if (key is ConsoleKey.Enter)
{
break;
}
if (key is ConsoleKey.Escape)
{
returnToMainMenu = true;
break;
}
}
}
}