본문 바로가기

KDT/C# 프로그래밍50

23/07/26 인벤토리 생성 복습 using Starcraft; using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Net.Mail; using System.Runtime.Serialization.Formatters; using System.Text; using System.Threading.Tasks; namespace Starcraft { internal class App { //생성자 메서드 public App() { //아이템 배열변수 items 정의 Item[] items; //items변수에 크기가 5인 아이템 배열 인스턴스 생성후 할당 i.. 2023. 7. 25.
23/07/25 배열 복습2 using Starcraft; using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Net.Mail; using System.Runtime.Serialization.Formatters; using System.Text; using System.Threading.Tasks; namespace Starcraft { internal class App { //생성자 메서드 public App() { //아이템 배열변수 items를 정의하고 배열의 인스턴스를 생성하고 할당 Item[] items = new Item[3]; Con.. 2023. 7. 25.
23/07/25 배열 복습 using Starcraft; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.Mail; using System.Runtime.Serialization.Formatters; using System.Text; using System.Threading.Tasks; namespace Starcraft { internal class App { //생성자 메서드 public App() { //문자열 배열 변수 정의(itemNames) string[] itemNames; //문자열 배열 인스턴스 생성 (길이:3) itemNames = new string[3]; //배열.. 2023. 7. 25.
23/07/24 인벤토리 복습 (집에서) (연습내용 - 출력값) 장검 단검 활 [ ] [ ] ------------------------- 장검을 꺼냈습니다. ------------------------- [ ] 단검 활 [ ] [ ] ------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Starcraft { internal class Item { public string name; //생성자 메서드 public Item(string name) { this.name = name; } } } using System; using Sy.. 2023. 7. 25.
23/07/24 배열 기초 복습 (집에서) (연습 내용) 장검이 생성되었습니다. 단검이 생성되었습니다. 활이 생성되었습니다. => 장검 => 단검 => 활 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Starcraft { internal class Item { public string Name { get; set; } //생성자 메서드 public Item(string name) { this.Name = name; Console.WriteLine("{0}이 생성되었습니다.",this.Name); } } } using System; using System.Collecti.. 2023. 7. 24.
23/07/24 인벤토리 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Starcraft { internal class App { //생성자 메서드 public App() { Inventory inven = new Inventory(5); inven.AddItem(new Item("장검")); inven.AddItem(new Item("단검")); inven.AddItem(new Item("활")); inven.PrintAllItems(); string searchItemName = "장검"; Item item = inven.GetItemByName(s.. 2023. 7. 24.