목록Programming Language/C# (74)
091
🔍C#: CS_104 . 한 줄에 띄어쓰기를 포함한 두 숫자를 두 번 받아서 두 좌표의 거리를 구하세요. 1. 문제 정답(1) 첫 번째 방법 : using System;namespace C104{ class C104{ static void Main(string[] args){ string[] input1 = Console.ReadLine().Trim().Split(' '); //double x1 = Convert.ToDouble(input1[0]); double.TryParse(input1[0], out double x1); double.TryParse(input1[1], out double y1); ..
🔍C#: CS_103 . 입력 받은 값을 반지름으로 두고 원의 면적을 구하시오.(pi 값은 상수값으로 제공됩니다.) 숫자 리터럴이 아니라면 0.0000을 반환하시오. 1. 문제 정답using System;namespace CS_103{ class CS_103{ const double pi = 3.1415926; static void Main(string[] args) { double input = CheckNumber(); Console.Write($"{calCircle(Math.Pow(input,2)):F4}"); } static double calCircle(double x) {..
🔍C#: CS_102 . 두 숫자가 모두 정수이면서 짝수이면 가산 결과를 출력하세요. 만약, 요구에 부합하지 않은 숫자가 들어올 경우 숫자를 0으로 변환 후 가산하세요. 1. 문제 정답(1) 첫 번째 방법 : using System;namespace CS102{ class CS102{ static void Main(){ string input1 = Console.ReadLine(); string input2 = Console.ReadLine(); int num1 = 0; int num2 = 0; if(int.TryParse(input1, out int n1)){ ..
🔍C#: CS_101 .개행으로 입력 받은 두 입력값을 한 줄에 출력하시오. 1. 문제 정답using System;namespace CS_206{ class CS_206{ static void Main(string[] args){ string input1 = Console.ReadLine(); string input2 = Console.ReadLine(); Console.Write($"{input1} {input2}"); } }} 2. 정리- 문자열 보간을 이용하여 출력하였습니다.
01. VS Code에 C# 확장 프로그램 설치 - 각 언어는 어떤 운영체제에서든 실행될 수 있게 해주는 공식 실행 환경(Runtime)이라는게 있는데, 그게 C#에서는 .NET Runtime임. Java는 JVM(Java Virtual Machine)이고, Python의 경우 CPython임 (1) VS Code 설치 : 원래 VS code를 설치하면 자동으로 .NET SDK까지 설치되는게 일반적이지만 설치 되어 있지 않았을 경우에는 .NET SDK를 쳐서 다운로드를 받으면 됨 (2) VS Code 내부에서 C#, C# Dev Kit, IntelliCode for C# Dev Kit와 Code Runner을 다운 : - C#, C# Dev Kit, IntelliCode for C# Dev Kit : ..
* 언급이 없을 경우 기즈모방향이 왼쪽좌표계인 경우를 기준으로 말하고 있습니다. *01. 바람개비 돌리기-> Cube scale (10,30,1), rotation(0,0,0)using System.Collections;using System.Collections.Generic;using UnityEngine;//using UnityEngine.SceneManagement;public class vane_ggi : MonoBehaviour{ void Update(){ transform.Rotate(0,0,-10); }}02. 위에서 아래로 내려오는 공이 다시 위로 올라가기-> Sphere scale(3,3,3)using System.Collections;using System.Co..
01. Prefab- Unity에서 재사용 가능한 게임 오브젝트 템플릿으로, 여러 번 재사용하거나 다양한 씬에서 일관되게 사용할 수 있음-> 특정 키코드를 눌렀을 때 설정된 프리랩을 복제하는 코드using System.Collections;using System.Collections.Generic;using UnityEngine;//using UnityEngine.SceneManagement;public class In_ggi : MonoBehaviour{ public GameObject nameC; void Update(){ if(Input.GetKeyDown(KeyCode.Z)) Instantiate(nameC, nameC.transform.position,..
01. GameManager- Unity에서 게임의 전반적인 흐름과 상태를 관리하는 중심 역할을 하는 스크립트를 의미, 개발자가 필요에 따라 만들어 사용하는 관습적인 디자인 패턴 -> 게임 상태나 공통 데이터 등을 중앙에서 조율하고 관리함-> 코인 수를 세는 메서드를 GameManger만들어 붙이고 공에서 실행시켜서 세기using System.Collections;using System.Collections.Generic;using UnityEngine;//using UnityEngine.SceneManagement;public class gameManagerS : MonoBehaviour{ private int ycount = 0; public void CountMethod(){ ..