K-digital traning/C#프로그래밍 18

스타크래프트 - 마린, 저글링, 메딕

(1) 마린 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LearnDotnet { internal class Marine { //멤버 변수 : 객체의 생명주기동안 유지된다 int hp; int maxHp; int damage; float moveSpeed; int x; int y; //생성자 public Marine(int maxHp, int damage, float moveSpeed, int x, int y) { this.maxHp = maxHp; this.hp = maxHp; this.damage = damage; this..

반복문 for

using System; namespace LearnDotnet { internal class Program { static void Main(string[] args) { //1번 문제 for(int i = 0; i < 5; i++) { Console.WriteLine("줄넘기를 했습니다."); } //2번 문제 for (int i = 0; i < 4; i++) { Console.WriteLine("줄넘기를 {0}회 했습니다.", i+1); } //3번 문제 { int answer=0; for (int i = 0; i < 3; i++) { Console.WriteLine("쌩쌩이를 했습니다."); answer+=2; } Console.WriteLine("---------------------------..

Input, enum 활용

using System; namespace LearnDotnet { internal class Program { enum race { terran=1, protoss, zerg } static void Main(string[] args) { Console.Write("(1.테란, 2.프로토스, 3.저그) 종족의 번호를 입력하세요: "); string input = Console.ReadLine(); Console.WriteLine("input: {0}", input); race selectedRace = (race)(Convert.ToInt32(input)); Console.WriteLine("당신은 {0}을 선택했습니다.", selectedRace); } } }

HelloWorld

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HelloWorld { internal class Program { static void Main(string[] args) { //변수를 선언하고 값을 할당 (변수의 초기화) string characterName = "홍길동"; Console.WriteLine("이름: {0}", characterName); int level; //변수의 정의, 선언 level = 12; //값을 level이라는 이름의 변수에 저장 (값을 할당) Console.WriteLine("레벨: {0}", ..