상품 목록(2)
Console/실습 2019. 9. 23. 17:48
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
|
string a = "장검";
string b = "단검";
string c = "활";
string d = "도끼";
int goldNow = 5000;
int priceLongSword = 800;
int priceShortSword = 550;
int priceBow = 760;
int priceAxe = 810;
Console.WriteLine("-------------------------------------");
Console.WriteLine("금화 : " + goldNow);
Console.WriteLine("-------------------------------------");
Console.WriteLine("상품 목록");
Console.WriteLine("-------------------------------------");
Console.WriteLine("1.장검 : " + priceLongSword);
Console.WriteLine("2.단검 : " + priceShortSword);
Console.WriteLine("3.활 : " + priceBow);
Console.WriteLine("4.도끼 : " + priceAxe);
Console.WriteLine("-------------------------------------");
Console.WriteLine("상점에서 구입하고자 하는 아이템을 입력하세요.");
string input = Console.ReadLine();
Console.WriteLine(input + "을 구매했습니다.");
Console.WriteLine("-------------------------------------");
if (input == a)
{
Console.WriteLine(input + "을 구매했습니다.(-" + priceLongSword + ")");
goldNow = goldNow - priceLongSword;
Console.WriteLine("금화 : " + goldNow);
}
else if (input == b)
{
Console.WriteLine(input + "을 구매했습니다.(-" + priceShortSword + ")");
goldNow = goldNow - priceShortSword;
Console.WriteLine("금화 : " + goldNow);
}
else if (input == c)
{
Console.WriteLine(input + "을 구매했습니다.(-" + priceBow + ")");
goldNow = goldNow - priceBow;
Console.WriteLine("금화 : " + goldNow);
}
else if (input == d)
{
Console.WriteLine(input + "을 구매했습니다.(-" + priceAxe + ")");
goldNow = goldNow - priceAxe;
Console.WriteLine("금화 : " + goldNow);
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
