카테고리 없음 [모바일프로그래밍] 2. C# _ ppt4장 yb.lee 2017. 10. 12. 01:40 1. 배열 class ex06Arr { static void Main(string[] args) { //배열을 생성 int[] intArr = { 52, 273, 32, 65, 103 }; //배열의 요소를 변경 intArr[0] = 0; Console.WriteLine(intArr[0]); //출력 : 0 Console.WriteLine(intArr[1]); //출력 : 273 Console.WriteLine(intArr[2]); //출력 : 32 } } 2. 반복문과 배열의 길이 class ex07Len { static void Main(string[] args) { //변수를 선언 int i = 0; int[] intArray = { 52, 273, 32, 65, 103}; //반복을 수행 while(i < intArray.Length) { //출력 Console.WriteLine((i+1)+ "번째 출력 : " + intArray[i]); //탈출을 위해 변수를 더함 i++; } } } 3. foreach 4. 이동하는 달팽이 static void Main(string[] args) { int x = 1; while(x < 50) { // 콘솔화면을 지움 Console.Clear(); //콘솔 화면의 특정한 위치로 커서를 옮김(x축,y축) Console.SetCursorPosition(x, 3); if (x % 3 == 0) Console.WriteLine("__@"); else if (x % 3 == 1) Console.WriteLine("_^@"); else Console.WriteLine("^-@"); //특정한 시간만큼 스레드를 정지한다. Thread.Sleep(100); x++; } } 5. 문자열 응용(대문자 소문자 / 문자열 자르기) 공유하기 게시글 관리 유비니닷컴 '전체' Related Articles [모바일프로그래밍] 1. C# _ ppt1장~3장