4일차 *** 상점 ***
Console Programming/C# Console 2019. 9. 23. 11:32*** 상점 ***
[장검, 단검, 활, 도끼]
상점에서 구입하고자 하는 아이템을 입력해주세요. 입력:장검
장검을 구매했습니다.
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax08
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("*** 상점 ***");
Console.WriteLine("[장검, 단검, 활, 도끼]");
Console.WriteLine();
Console.Write("상점에서 구입 하고자 하는 아이템을 입력해주세요.");
string input = Console.ReadLine();
if (input == "장검")
{
Console.WriteLine($"{input}을 구매했습니다.");
}
else if (input == "단검")
{
Console.WriteLine($"{input}을 구매했습니다.");
}
else if (input == "활")
{
Console.WriteLine($"{input}을 구매했습니다.");
}
else if (input == "도끼")
{
Console.WriteLine($"{input}을 구매했습니다.");
}
else
{
Console.WriteLine($"해당상품 (\"{input}\")는 없습니다.");
}
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
'Console Programming > C# Console' 카테고리의 다른 글
4일차 *** 상점 *** (3) (0) | 2019.09.23 |
---|---|
4일차 *** 상점 *** (2) (0) | 2019.09.23 |
구구단 출력3 의 코드 수정 (0) | 2019.09.21 |
2일차 ***별찍기2*** 의 코드 수정 (0) | 2019.09.21 |
goto 문 (0) | 2019.09.20 |