본문 바로가기

프로그래밍 _공부자료./C++ 공부46

C# 유니티 오디오 컴퍼넌트 만들기. using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(AudioSource)) ] // unity 창에서 audio사운드 넣을수 있게. public class Control : MonoBehaviour { private float h = 0.0f; private float v = 0.0f; private float r = 0.0f; private float moveSpeed = 10.0f; private float rotationSpeed = 100.0f; private Transform playerTr; private int key; public AudioClip ksyS.. 2022. 1. 13.
유니티 C# 객체 끼리 충돌 할때 뭔가를 하고 싶을때 ??? 필요한 함수 using System.Collections; using System.Collections.Generic; using UnityEngine; public class player : MonoBehaviour { Rigidbody rigid; public float Jump_Power; bool isJump; void Awake() { rigid = GetComponent(); } void Update() { if (Input.GetButtonDown("Jump") && !isJump) { isJump = true; rigid.AddForce(new Vector3(0, Jump_Power, 0), ForceMode.Impulse); } } // Update is called once per frame voi.. 2022. 1. 6.
c++로 설문조사 프로그램 만들기. #include "pch.h" #include #include #include #include #include using namespace std; class Survey { public: struct Survey_info { string survey_array[10][5]; string survey_array_answer[10]; int exam_answer; int survey_page; Survey_info() { memset(this, 0x00, sizeof(Survey_info)); }; }Survey_info_; map Survey_map; void make_survey(); void Survey_Show(); int page = 1; int show_number = 1;// 항목 개수 int.. 2021. 12. 5.
배열을 활용하고 순서 짝수는 왼쪽으로 홀수는 오른쪽으로 정렬하여 출력하기. 문제) 배열[10]칸의 초기화가 되었다 1,2,3,4,5,6,7,8,9,10 위와같이 배열의 초기화가 되어 있는 상태에서 배열의 순서를 바꿔서 배열크기의 반을잘라 홀수는 왼쪽부터 짝수는 오른쪽부터 1,3,5,7,9,2,4,6,8,10 의 순서가 나오도록 출력하라. 아래는 구현한 배열과 for문을 활용하여 구현한 소스코드 이다. #include #include int main() { int array[10] = { 1,2,3,4,5,6,7,8,9,10 }; int num=10; int temp; int cnt_2 = 5; int cnt_1 = 0; int temparray[10] = { 0, }; for (int i = 0; i < num; i++) { if (array[i] % 2 == 0) { temp.. 2020. 2. 8.