forked from BY-SUVNET-OOP-2020/Bureau_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (36 loc) · 1.07 KB
/
Program.cs
File metadata and controls
41 lines (36 loc) · 1.07 KB
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
using System;
class Program
{
static void Main(string[] args)
{
string contents = "";
System.Console.WriteLine("Öppnar byrålådan...");
while (true)
{
System.Console.Write("Vad vill du lägga i byrålådan: ");
string input = Console.ReadLine();
if (input.ToLower() == "q" || input.ToLower() == "inget")
{
Console.WriteLine("Stänger byrån...");
Environment.Exit(0);
}
else if (input.ToLower() == "t" || input.ToLower() == "töm")
{
System.Console.WriteLine("Tömmer byrån på " + contents);
contents = "";
}
else
{
if (contents.Length == 0)
{
contents = input.Trim();
}
else
{
contents = contents + " och " + input.Trim();
}
}
Console.WriteLine($"Byrån innehåller nu {contents}");
}
}
}