분류 전체보기
-
03/12 수업내용 메모C#/수업내용 2021. 3. 15. 09:56
2021/03/12 pass by value 값형식을 매개변수로 넘길 때 복사본을 넘긴다 pass by reference 매개변수로 가져온 참조형식 값를 수정할 경우 원본데이터도 같이 수정 ref 값 형식이지만 참조 유형으로 전달, 사용전 변수를 초기화 해야함 호출과 정의 모두 ref를 작성 out ref와 같은데 초기화가 필요없음 params 가변 매개변수 키워드, 매개변수는 배열클래스의 인스턴스를 받음 struct class와 같으나 스택메모리에 저장 배열 동일한 데이터 형식의 여러 요소를 저장, 미리 정의 된 항목 수, 고정 된 수의 요소를 순차적으로 저장, 배열은 인덱스 0 에서 값 저장 시작, new 키워드를 이용해서 배열의 인스턴스를 생성 배열인스턴스.Length -1 배열의 길이 배열의 요소..
-
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..