'
C#
'에 해당되는 글
17
건
2010/02/01
Array
2010/02/01
Method
2010/02/01
연산자
2010/02/01
Windows Form 띄워보기
2010/02/01
Type
Program/C#.NET
2010/02/01 09:58
Array
using System; namespace Ex07Array { class Program { static void Main(string[] args) { Random r = new Random(); #region 배열 선언 및 접근 //1. //int[] ar1 = new int[10]; //for (int i = 0; i < 10; i++) //{ // ar1[i] = r.Next(100, 1000); //} //for (int i = 0; i < 10; i++) //{ // Console.WriteLine("ar[{0}] = {1}", i, ar1[i]); //} //Console.WriteLine(); //Console.WriteLine(); #endregion #region 다차원 배열 //2. //int[,] ar2 = new int[5, 7]; //for (int i = 0; i < 5; i++) //{ // for (int j = 0; j < 7; j++) // { // ar2[i, j] = r.Next(100, 1000); // } //} //for (int i = 0; i < 5; i++) //{ // for (int j = 0; j < 7; j++) // { // Console.Write("{0,5}",ar2[i,j]); // } // Console.WriteLine(); //} #endregion #region 배열 초기화 ////3. //int[] ar3_1 = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; ////int[] ar3_1 = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; ////int[] ar3_1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; //for (int i = 0; i < 10; i++) //{ // Console.Write("{0,3}",ar3_1[i]); //} //Console.WriteLine(); //int[,] ar3_2 = new int[2, 3] { {1, 2, 3}, {4, 5, 6} }; //for (int i = 0; i < 2; i++) //{ // for (int j = 0; j < 3; j++) // { // Console.Write("{0,3}",ar3_2[i,j]); // } // Console.WriteLine(); //} #endregion #region 배열 지원 메서드 / 프로퍼티 //4. //int[] ar4_1 = new int[10]; ////배열.Length : 배열 요소의 갯수를 반환 //for (int i = 0; i < ar4_1.Length; i++) //{ // ar4_1[i] = r.Next(100, 1000); //} //Console.Write("Before Sorting : "); //for (int i = 0; i < ar4_1.Length; i++) //{ // Console.Write("{0,5}",ar4_1[i]); //} //Console.WriteLine(); //Console.Write("After Sorting : "); //Array.Sort(ar4_1); //오름차순 정렬 ////Array.Reverse(ar4_1); //배열을 역순으로 재정렬 //for (int i = 0; i < ar4_1.Length; i++) //{ // Console.Write("{0,5}",ar4_1[i]); //} //Console.WriteLine(); //Console.Write("Input Number : "); //int number = int.Parse(Console.ReadLine()); //Console.WriteLine("입력된 숫자의 배열 내 위치 : {0}", Array.IndexOf(ar4_1, number)); ////요소의 위치 없으면(-1) //////////////////////////////////////////////////////// //int[,] ar4_2 = new int[2, 3]; //for (int i = 0; i < ar4_2.GetLength(0); i++) //{ // for (int j = 0; j < ar4_2.GetLength(1); j++) // { // ar4_2[i, j] = r.Next(100, 1000); // } //} //for (int i = 0; i < ar4_2.GetLength(0); i++) //{ // for (int j = 0; j < ar4_2.GetLength(1); j++) // { // Console.Write("{0,5}",ar4_2[i,j]); // } // Console.WriteLine(); //} #endregion #region 가변 배열 전달인자 //5. //TestMethod(1); //TestMethod(1, 2); //TestMethod(1,2,3,4,5,6,7,8); #endregion #region Zagged Array //6. int[][] ar6 = new int[10][]; for (int i = 0; i < ar6.Length; i++) { ar6[i] = new int[r.Next(5, 15)]; } for (int i = 0; i < ar6.Length; i++) { for (int j = 0; j < ar6[i].Length; j++) { ar6[i][j] = r.Next(100, 1000); } } for (int i = 0; i < ar6.Length; i++) { for (int j = 0; j < ar6[i].Length; j++) { Console.Write("{0,5}",ar6[i][j]); } Console.WriteLine(); } #endregion } //가변 배열 전달인자 관련 private static void TestMethod(params int[] p) { Console.WriteLine("전달인자의 갯수 : {0}",p.Length); } } }
web20korea
2010/02/01 09:58
2010/02/01 09:58
C#
0
0
http://web20korea.com/trackback/295
오픈아이디로 글쓰기
[
로그인
][
오픈아이디란?
]
이름/비밀번호로 글쓰기
name
password
homepage
secret reply
Program/C#.NET
2010/02/01 09:54
Method
using System; namespace Ex05Method { class Program { static void Main(string[] args) { Console.Write("박스그리기에 사용할 문자 : "); string drawingUnit = Console.ReadLine(); int width = InputInt("박스의 넓이 : "); int height = InputInt("박스의 높이 : "); DrawBox(drawingUnit, width, height);//호출시 데이터 전달 } private static int InputInt(string message) { Console.Write(message + " : "); int data = int.Parse(Console.ReadLine()); //메스드를 종료하고 메서드 호출 영역으로 data를 반환 return data; } private static void DrawBox(string drawingUnit, int width, int height) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (i == 0 || i == height - 1 || j == 0 || j == width - 1) { //Console.Write("*"); Console.Write(drawingUnit); } else { Console.Write(" "); } } Console.WriteLine(); } } } }
web20korea
2010/02/01 09:54
2010/02/01 09:54
C#
0
0
http://web20korea.com/trackback/294
오픈아이디로 글쓰기
[
로그인
][
오픈아이디란?
]
이름/비밀번호로 글쓰기
name
password
homepage
secret reply
Program/C#.NET
2010/02/01 09:51
연산자
using System; namespace Ex04ControlStatement { class Program { static void Main(string[] args) { //Calculator (+, -, *, /, %) #region input operation Console.Write("Input First Operand : "); int operanda = int.Parse(Console.ReadLine()); Console.Write("Input Operator (+,-,*,/,%) : "); string op = Console.ReadLine(); Console.Write("Input Second Operand : "); int operandb = int.Parse(Console.ReadLine()); #endregion int result = 0; #region operation (if - else) //if (op.Equals("+")) //{ // result = operanda + operandb; //} //else if (op == "-") // result = operanda - operandb; //else if (op == "*") // result = operanda * operandb; //else if (op == "/") // result = operanda / operandb; //else if (op == "%") // result = operanda % operandb; //else //{ // Console.WriteLine("Invalid Operator !!!"); // return; //} #endregion #region operation (switch - case) switch (op) { case "+": result = operanda + operandb; break; case "-": result = operanda - operandb; break; case "*": result = operanda * operandb; break; case "/": result = operanda / operandb; break; case "%": result = operanda % operandb; break; default: Console.WriteLine("Invalid Operator"); break; } #endregion Console.WriteLine( "{0} {1} {2} = {3}", operanda, op, operandb, result); } } } /* 관계연산자 (두 데이터의 대소 관계를 비교 --> 참/거짓 판단) 1. == : 같다 (cf : 대입연산자(=)와 구분) 2. != : 다르다 3. > : 크다 4. >= : 크거나 같다 5. < : 작다 6. <= : 작거나 같다 ex) 10 == 10 : true, 10 == 5 : false */
web20korea
2010/02/01 09:51
2010/02/01 09:51
C#
0
0
http://web20korea.com/trackback/293
오픈아이디로 글쓰기
[
로그인
][
오픈아이디란?
]
이름/비밀번호로 글쓰기
name
password
homepage
secret reply
Program/C#.NET
2010/02/01 09:47
Windows Form 띄워보기
using System; using System.Windows.Forms; using System.Drawing; namespace Ex03WinForm { class Program { static void Main(string[] args) { Form form = new Form(); form.Text = "Hello, Windows Forms"; form.Width = 500; form.Height = 350; form.BackColor = Color.Orange; Button button = new Button(); button.Width = 200; button.Height = 100; button.BackColor = Color.Purple; button.Text = "Push Me !!!!!"; int x = form.ClientRectangle.Width / 2 - 100; int y = form.ClientRectangle.Height / 2 - 50; button.Location = new Point(x, y); button.Click += new EventHandler(button_Click); form.Controls.Add(button); //form.Show();//Modeless 방식 form.ShowDialog();//Modal 방식 } static void button_Click(object sender, EventArgs e) { MessageBox.Show("Thank You for Clicking Me !!!!!"); } static void form_MouseClick(object sender, MouseEventArgs e) { MessageBox.Show("X : " + e.X + " / Y : " + e.Y); } static void form_Click(object sender, EventArgs e) { MessageBox.Show("폼 위에서 마우스가 클릭되었습니다."); } } }
web20korea
2010/02/01 09:47
2010/02/01 09:47
C#
0
0
http://web20korea.com/trackback/292
오픈아이디로 글쓰기
[
로그인
][
오픈아이디란?
]
이름/비밀번호로 글쓰기
name
password
homepage
secret reply
Program/C#.NET
2010/02/01 09:43
Type
Person.cs
using System; enum RelationType { Family = 1, Friend,//2 Biz,//3 Community//4 } struct Person { //public int Number; public Int32 Number; public string Name; public string Phone; public string Email; public RelationType Relation; }
Program.cs
using System; namespace Ex02Type { class Program { static void Main(string[] args) { //객체 생성 Person person = new Person(); //값 할당 person.Number = 1; person.Name = "장동건"; person.Phone = "010-9563-4487"; person.Email = "
jdk@example.com
"; person.Relation = RelationType.Biz; Console.WriteLine("[{0}][{1}][{2}][{3}][{4}][{5}]", person.Number, person.Name, person.Phone, person.Email, person.Relation, (int)person.Relation); } } }
web20korea
2010/02/01 09:43
2010/02/01 09:43
C#
0
0
http://web20korea.com/trackback/291
오픈아이디로 글쓰기
[
로그인
][
오픈아이디란?
]
이름/비밀번호로 글쓰기
name
password
homepage
secret reply
«이전
1
2
3
4
다음»
blog
tag cloud
travel log
quest book
by
web20korea
info@web20korea.com web20korea@gmail.com
전체
(274)
i6020345
(87)
음악
(19)
독서
(1)
영화
(3)
좋아하는+_+
(3)
AION
(2)
Blogs
(21)
Program
(67)
C#.NET
(17)
ASP.NET
(6)
Classic ASP
(21)
JavaScript
(8)
html
(3)
Classic Mobile
(6)
Mobile
(0)
iPhoneApps
(0)
Tools
(23)
Open Source
(2)
DMBS
(16)
web-based Tools
(1)
Utils
(4)
Project
(62)
informative
(14)
gohome
(0)
«
2010/08
»
일
월
화
수
목
금
토
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Response.Buffer=true
MNA
SQL command not properly ended
동적 리퀘스트
블로그메타
HTTP ERROR
연착
은평구 시설관리공단
Jan Debis
iSP
KHUB
바보같은..
설치형 블로그
request
RSS
스쿠터
ROWNUM
메타블로그
오픈소스
vb6ko.dll 오류
mixmaster mike
구인구직
ORACLE + ASP
별점주기 스크립트
OOP
블로그축제
prestige
대한민국블로거컨퍼런스
서울자동차경매
부팅에러
five minutes of funk - 최근 글
패핑 1.4
베스트 키즈
엽문2
(2)
윈도우 7 팁
[MSSQL] 내장 MD5 암호화 활용
five minutes of funk - 최근 댓글
web20korea
07/14
캑.....견자단이 포스가좀 쎼죠 ㅎㅎㅎ ㄷㄷ
호호미니
07/14
포스에 압도되어 갑니다 ㅋ
web20korea
06/28
왜이래? 죠낸 잘써먹고 있구믄~?ㅋㅋㅋㅋㅋㅋㅋㅋ...
김경훈
06/28
진짜 딱 너만 그렇게 쓸꺼다 아마 ㅋㅋ
web20korea
06/04
쩔더라...ㅇㅇ
행복한 우리집
01/20
환영합니다
어흥이 굴에 들어와도 정신만 차리면 하나 건져간...
2009
"인터넷 문화에 대처하는 방법은?" 이라는 주제에...
주네의 열린 소프트웨어
2009
아시아 오픈소스
iPod Life
2009
iPod Touch 's Sadari 체험기
Life OS X 10.5 Leopard
2008
iPod touch 2nd 리뷰 - 간단리뷰
2010/07
(2)
2010/06
(4)
2010/05
(2)
2010/03
(2)
2010/02
(11)
Across The Universe.
Mnet.
Portfolio Publics Modem.
ryu1hwan님의 블로그.
♪ ♬ ♪ Into The Music ♪ ♬ ♪.
민준이형.
슬기.
Copyright ⓒ 2010.
web20korea
, Skin designed by
Creasmworks.
All rights reserved.
0