This repository has been archived by the owner on Jan 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
82 lines (72 loc) · 2.55 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
using System;
using System.Globalization;
using System.Collections.Generic;
namespace GuessTheNumber
{
class Question
{
public string question;
public string tooMuch;
public string tooLess;
public string prize;
}
class Program
{
static void Main(string[] args)
{
//Czesc do wychwytywania jezyka systemu
CultureInfo cultureInfo = CultureInfo.InstalledUICulture;
string language = cultureInfo.TwoLetterISOLanguageName;
switch (language)
{
case ("pl"):
Console.WriteLine("Wykryłem język polski: ");
break;
case ("de"):
Console.WriteLine("Ich habe Deutsch entdeckt");
break;
case ("en"):
Console.WriteLine("I detected English language");
break;
}
Dictionary<string, Question> questions = new Dictionary<string, Question>()
{
{"pl",new Question(){question="Podaj liczbe: ",tooLess="Za mało!",tooMuch="Za dużo!",prize="Wygrałeś!"}},
{"en",new Question(){question="Give a number: ",tooLess="To less!",tooMuch="Too much!", prize="Congratulations, You Won!"}},
{"de",new Question(){question="Geben Sie die Nummer ein :",tooLess="Zu viel!",tooMuch="Nicht genug!",prize="Won!"}}
};
string question = "", tooMuch = "", tooLess = "", prize = "";
if (questions.ContainsKey(language))
{
question = questions[language].question;
tooMuch = questions[language].tooMuch;
tooLess = questions[language].tooLess;
prize = questions[language].prize;
}
//koniec czesci do wychwytywania jezyka systemu
Random r = new Random();
int n = r.Next(100);
bool w = false;
do
{
Console.Write(question);
string s = Console.ReadLine();
int l = int.Parse(s);
if (l > n)
{
Console.WriteLine(tooMuch);
}
else if (l < n)
{
Console.WriteLine(tooLess);
}
else
{
Console.WriteLine(prize);
w = true;
}
}
while (w == false);
}
}
}