C#
-
03/12 1주차 주말과제C#/수업과제 2021. 3. 15. 01:05
w, a, s, d키를 사용하여 스타크래프트 벌처의 움직임을 조작하고 i키를 이용하여 스파이더 마인을 매설, r키로 재시작이 가능하게 구현 Program.cs namespace Study02 { class Program { static void Main(string[] args) { new App(); } } } App.cs using System; namespace Study02 { public class App { public App() { Screen screen = new Screen(); Vulture vulture = new Vulture(); Console.WriteLine("아무키나 누르면 시작됩니다."); while(true) { ConsoleKeyInfo input = Console.R..
-
03/12 배열 선언 및 출력 연습 floatC#/수업내용 2021. 3. 12. 13:15
Program.cs using System; namespace Study02 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); new App(); } } } App.cs using System; namespace Study02 { public class App { public App() { //float배열 변수 선언 float[] arr; //float배열 인스턴스 생성 (빈배열) Console.WriteLine("배열 요소 갯수 입력"); int num = Convert.ToInt32(Console.ReadLine()); arr = new float[num]; //float배열 인스턴스 요소에 값..
-
03/12 배열 선언 및 출력 연습 intC#/수업내용 2021. 3. 12. 13:01
Program.cs using System; namespace Study02 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); new App(); } } } App.cs using System; namespace Study02 { public class App { public App() { //int배열 변수 선언 int[] arr; //int배열 인스턴스 생성 (빈배열) arr = new int[7]; //int배열 인스턴스 요소에 값 할당 //3, 1, 4, 1, 5, 9, 2 arr[0] = 3; arr[1] = 1; arr[2] = 4; arr[3] = 1; arr[4] = 5; arr[5] ..
-
03/12 배열 선언 및 출력 연습 stringC#/수업내용 2021. 3. 12. 12:53
Program.cs using System; namespace Study02 { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); new App(); } } } App.cs using System; namespace Study02 { public class App { public App() { //string배열 변수 선언 string[] vs; //string배열 인스턴스 생성 (빈배열) vs = new string[3]; //string배열 인스턴스 요소에 값 할당 //"홍길동", "임꺽정", "장길상" vs[0] = "홍길동"; vs[1] = "임꺽정"; vs[2] = "장길상"; //배열의 길이 ..
-
03/11 수업내용 메모C#/수업내용 2021. 3. 11. 18:17
2021/03/11 클래스(Class) 정보와 기능을 정의하여 개체들을 제작, 클래스는 형식, 나만의 형식을 만들기 위해, 사용자 정의 형식, 참조형식, 파일 맴버변수 지역번수(local) 스택프레임 메소드는 스택프레임에 쌓임 .net memory management 스택오버플로우 가비지컬랙터 앱, 인게임 참조형식(object, 사용자 정의 형식, string) 스택과 힙 메모리 둘다 사용, 스택은 주소값, 힙은 값 new 연산자 힙 메모리에 인스턴스를 실체화, 새 유형(사용자 정의 형식)의 인스턴스를 만듦 인스턴스=개체=메모리에 실체화된 것 네임스페이스 소속, 생성자, 생성자 메소드 인스턴스를 생성할 때 자동으로 호출 프로세스 프로그램을 실행, 동작하고 있는 상태 추상화 구체적이지 않게 생각하는 것, ..
-
03/11 클래스 생성 -> 인스턴스 생성 연습C#/수업과제 2021. 3. 11. 17:37
Program.cs namespace study01 { class Program { static void Main(string[] args) { new App(); } } } App.cs using System; namespace study01 { public class App { public App() { Console.WriteLine("App생성자"); //질럿 Zealot zealot = new Zealot(); zealot.hp = 100; Console.WriteLine("질럿의 hp :" + zealot.GetHp()); Console.WriteLine(zealot); //드라군 Dragoon dragoon = new Dragoon(); dragoon.groundAttack = 20; Con..
-
03/10 매개변수가 있고 반환 값이 있는 메서드 정의 및 호출C#/수업과제 2021. 3. 11. 01:07
using System; namespace Study00 { class Program { static void Main(string[] args) { Console.WriteLine("메소드 호출"); Console.WriteLine("아이템을 강화하여 {0}가 되었습니다.", ReinforceEquipment("무형검", "무색 큐브 조각")); Console.WriteLine(CompareNumbers(10, 20)); Console.WriteLine("시험에 {0}하셨습니다.", JudgeScore(61)); BuildGateway(160, true); Console.WriteLine("계좌에 돈을 입금하여 잔고가 {0}원이 되었습니다.", DepositMoney(10000)); Console.Wr..
-
03/10 매개변수가 없고 반환값이 있는 메서드 정의 및 호출C#/수업내용 2021. 3. 11. 00:52
using System; namespace Study00 { class Program { enum eClass { GhostKnight, Fighter, Gunner, Mage } static void Main(string[] args) { //매개변수가 없고 반환값이 있는 메서드 정의 및 호출 Console.WriteLine("메서드 호출"); Console.WriteLine("반 인원수는 {0}명 입니다.", GetClassNumberOfPeople()); Console.WriteLine("소지 물약 갯수는 {0}개 입니다.", GetNumberOfPotions()); Console.WriteLine("원주율은 {0}입니다.", getPi()); Console.WriteLine("캐릭터의 전직은 {0..