본문 바로가기

프로그래밍20

배열 자르기 정수 배열 numbers와 정수 num1, num2가 매개변수로 주어질 때, numbers의 num1번 째 인덱스부터 num2번째 인덱스까지 자른 정수 배열을 return 하도록 solution 함수를 완성해보세요. https://developer-talk.tistory.com/751 [C#]배열 특정 인덱스부터 자르는 방법 배열 특정 인덱스부터 자르는 방법 이번 포스팅은 C#에서 특정 인덱스부터 배열을 자르는 몇 가지 방법을 소개합니다. 방법 1. Array 클래스의 Copy 메서드 Array 클래스에서 제공하는 Copy() 메서드를 developer-talk.tistory.com 2023. 9. 13.
Float를 Int로 변환 https://www.delftstack.com/ko/howto/csharp/convert-float-to-int-in-csharp/#google_vignette C#에서 Float를 Int로 변환 C#에서 float를 int로 변환하는 데 사용할 수있는 4 가지 주요 메서드는 명시 적 형식 변환 메서드, Math.Ceiling() 함수, Math.Floor() 함수 및 Math.Round() 함수입니다. www.delftstack.com using System; public class Solution { public int solution(int num1, int num2) { int answer = 0; float a = (float)num1 / num2 * 1000; //float -> int로 변.. 2023. 9. 7.
정수 찾기 자바의 for구문에서 콜론(:)의 기능 - for( Object : List) 가끔 JAVA 소스코드를 보고 있다보면 다음과 같은 구문을 살펴 볼 수가 있다. for (Object obj... blog.naver.com for(A : B) -> B에서 차례대로 객체를 꺼내서 A에다가 넣겠다. B에 더이상 꺼낼 객체가 없을 때까지 class Solution { public int solution(int[] num_list, int n) { for(int num : num_list) { if(num == n) { return 1; } } return 0; } } C# public class Solution { public int solution(int[] num_list, int n) { foreach (i.. 2023. 8. 16.
[유니티] Rigidbody 중력 제어 Rigidbody Rigidbody rb = GetComponent(); rb.isKinematic = false; Rigidbody2D Rigidbody2D rb = GetComponent(); //방법1 -> rbody.bodyType = RigidbodyType2D.Dynamic rbody.gravityScale = 0; //방법2 rbody.bodyType = RigidbodyType2D.Static; https://docs.unity3d.com/kr/2020.3/Manual/class-Rigidbody2D.html 리지드바디 2D - Unity 매뉴얼 Rigidbody 2D 컴포넌트는 오브젝트를 물리 엔진이 제어하게 만듭니다. 스탠다드 Rigidbody 컴포넌트와 유사한 많은 개념이 리지드바디 .. 2023. 7. 27.
BrickGame <최종> namespace BrickGameFinal { internal class BALLDATA { public int nReady; public int nDirect; public int nX, nY; } } namespace BrickGameFinal { internal class Ball { BALLDATA m_tBall = new BALLDATA(); //C# 공의 방향 배열 정의 int[,] g_WallCollision = new int[4, 6] { { 3 , 2,-1,-1,-1, 4}, { -1 ,-1,-1,-1, 2, 1}, { -1 , 5, 4,-1,-1,-1}, { -1 ,-1, 1, 0, 5,-1}, }; Bar m_pBar; Block m_pBlock; //바 클래스도 가져와야 할 거 같.. 2023. 7. 13.
공 튕기기 namespace BrickGame6 { public class BALLDATA { public int nReady; //준비 공을 움직일지 안움직일지 public int nX, nY; //좌표 public int nDirect; //방향 } } namespace BrickGame6 { public class Ball { BALLDATA m_tBall = new BALLDATA(); //C#공의 방향 배열 정의 int[,] g_WallCollision = new int[4, 6] { { 3 , 2,-1,-1,-1, 4}, { -1 ,-1,-1,-1, 2, 1}, { -1 , 5, 4,-1,-1,-1}, { -1 ,-1, 1, 0, 5,-1}, }; public void gotoxy(int x, int y.. 2023. 7. 12.
728x90