본문 바로가기

IT/C#8

C# (배열을 이용하여 일주일 날씨 통계 출력) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoadBook.CsharpBasic.Chapter01.p0525 { class Ex002 { public void Run() { string[] weathers = new string[7]; weathers[0] = "suuny"; weathers[1] = "suuny"; weathers[2] = "rainy"; weathers[3] = "cloudy"; weathers[4] = "rainy"; weathers[5] = "snow"; weathers[6] = "suuny"; int.. 2021. 5. 25.
C# (팩토리얼 재귀함수) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoadBook.CsharpBasic.Chapter01.f0513 { class Factorial2 { public void Run() { Console.WriteLine(Factorial(5)); } static int Factorial(int n) { if(n==0 || n == 1) { return 1; } return n * Factorial(n-1); //재귀함수 } } } 2021. 5. 13.
C# (객체지향_자동차 클래스 설계) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoadBook.CsharpBasic.Chapter01.f0506 { class CarClass { public void Run() { Car001 car = new Car001(); car.setSize("세단"); car.setColor("하얀"); Console.WriteLine("고객님의 차, {0} {1}이...", car.getColor(), car.getSize()); car.Engine_on(); car.Go(); car.Back(); car.Left(); car.Ri.. 2021. 5. 6.
C# (은행 ATM 기기 프로그램) 은행 ATM 기기 프로그램 각 케이스별로 은행 프로그램이 동작해야 하기 때문에, switch문을 사용하는 것이 조건문 구현할 때 더 깔끔한 코드가 될 수 있다. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RoadBook.CsharpBasic.Chapter01.f0506 { class test3 { public void Run() { int money =0; Console.WriteLine("*******안녕하세요 Road Bank입니다.********"); Console.WriteLine("1: 잔액조회"); Console... 2021. 5. 6.