본문 바로가기

C#

(4)
[C#] 페졸드책연습중에 한글로 장난 재밌다. ^^;
[C#|초급] 사다리꼴 넓이 구하기 using System; namespace trapzoid { class Program { static void Main(string[] args) { double 윗변 = 3, 아랫변= 7, 높이 = 44; double 넓이; if(args.Length != 3) Console.WriteLine("사용법 : trapz.exe "); else { 윗변 = Convert.ToDouble(args[0]); 아랫변 = Convert.ToDouble(args[1]); 높이 = Convert.ToDouble(args[2]); } 넓이 = (윗변 + 아랫변) * 높이 / 2; Console.WriteLine("윗변이 {0}, 아랫변이 {1}, 높이가 {2}인 사다리꼴의 넓이는 {3}입니다.", 윗변, 아랫변, 높이..
[C#|초급] 성적입력 및 출력 using System; using System.IO; namespace 점수 { class Program { private static string[] 이름 = new string[30]; private static int[,] 점수 = new int[30,5]; private static string[] 학점 = new string[30]; private static string[] 성적구분 = { "중간", "기말", "과제물", "출석" }; private static TextReader 콘솔입력 = Console.In; private static TextWriter 콘솔출력 = Console.Out; //############### //# 여기가 시작 # //############### stat..
C# 예제 : 클래스 http://blog.mag2.com/m/log/0000141533/ 에 빚지고 있는 글입니다. C#을 모르는 상태에서 시험적으로 한글 변수명, 메소드명을 사용했기 때문에 표준적인 C# 코딩 컨벤션과 다를 수 있습니다. using System; namespace 날짜클래스 { class 윤날짜 { public int 해; public int 달; public int 날; } class Program { static void Main(string[] args) { 윤날짜 날짜 = new 윤날짜(); 날짜.해 = 2007; 날짜.달 = 4; 날짜.날 = 7; 날짜찍기(날짜); } private static void 날짜찍기(윤날짜 날짜) { Console.WriteLine("{0}년 {1}월 {2}일", 날..