C#(70)
-
출력서식
ex) static void Main(string[] args) { int num = 777; float pi = 12345.67777890f; string str1 = "가나다라", str2 = "abcd"; Console.WriteLine("str1 = {0}, str2 = {1}", str1, str2); //{인자의 번호, 띄워질 칸의 수} Console.WriteLine("오른쪽정렬 : {0,20}{1,20}", str1, str2); Console.WriteLine("왼쪽정렬 : {0,-20}{1,-20}", str1, str2); //{인자의 번호 : 값을 출력하고 남은 앞자릿수 0으로 채움} Console.WriteLine("10진수 : {0:D10}", num);//10진수 Console..
2016.12.11 -
ConsoleWrite()/WriteLine()
1. ConsoleWrite()와 ConsoleWriteLine()을 이용한 출력방법 ex1) static void Main(string[] args) { //\n -> 개행 이스케이프문자 Console.Write("문자열 출력 후 개행X"); Console.Write("\n개행 후 문자열 출력 후 개행X"); Console.WriteLine();//개행 Console.Write("문자열 출력 후 개행\n"); Console.WriteLine("문자열 출력 후 개행"); Console.WriteLine("문자열 출력 후 2줄 개행\n"); } ex2) static void Main(string[] args) { int num1 = 7, num2 = 77, num3 = 777, sum = 0; sum = ..
2016.12.11 -
Hello, World!
프로젝트생성 방법 1. Main 문에 내용을 입력하고 Ctrl + F5을 눌러 실행한 후 결과창을 확인합니다. ex) static void Main(string[] args) { Console.Write("1. Hello, World!"); Console.WriteLine("2. Hello, World!"); } Console.Write(" ");의 () 사이의 있는 문자열을 출력하게 됩니다. Write로 작성할 경우 출력한 후 줄바꿈을 하지 않고 WriteLine으로 작성할 경우 출력한 후 한 줄 내려서 작성하는 것을 확인 할 수 있습니다. WriteLine은 C언어에서 printf("Hello, World!\n")로 사용합니다.
2016.12.11 -
프로젝트 생성 방법
방법 1. Visual Studio 2008 1. 시작 -> Microsoft Visual Studio 2008폴더 -> Microsoft Visual Studio 2008 실행합니다.2. 파일 -> 새로만들기 -> 프로젝트를 클릭 or Ctrl + Shift + N을 눌러줍니다. 3. Visual C#을 클릭하고 콘솔 응용 프로그램을 선택하고 이름을 입력한 후 확인버튼을 클릭합니다. 4. 콘솔 응용 프로젝트가 생성 된 것을 확인합니다. using 지시문 - https://msdn.microsoft.com/ko-kr/library/sf0df423.aspx using문 - https://msdn.microsoft.com/ko-kr/library/yh598w02.aspx namespase - https://..
2016.12.11