목록BCA/1. C,C++,C# (13)
VioletaBabel
C#엔 우선순위 큐가 안보이더라. AStar를 유니티 상에서 짜려는데 있는게 훨씬 편할 것 같아서 작업 제대로 들어가기 전에 먼저 짜보았다.단, 내가 필요한 건 값이 작은 애부터 나오는 애. 큰 애부터 나오게 하려면 pop 함수에서 앞이 아닌 뒤부터 나오게 하면 된다. 노드를 담은 아이12345678910111213141516171819202122232425262728293031323334353637using System.Collections;using System.Collections.Generic;using UnityEngine; public class GridData : MonoBehaviour{ public int f; public static bool operator g2.f); } public..
멍청하니까 하드코딩함2차원 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316..
class 클래스명; class로 선언하면 파일이 중복포함되는 것을 막고, 해당 파일을 사용할 것이라는 선언만 하며 파일을 포함하지 않는다. 그래서 include하는 것보다 컴파일 시간이 현저히 줄어든다. 단, 객체를 선언하려면 객체의 크기를 알아야하기에 include를 해주어야 하고, 포인터로 선언하려면 class로 해준다.include를 많이하면 꼬일 수 있다. 그를 방지하기 위한 것이기도 함.
템플릿1234567891011121314151617181920212223242526#includeusing namespace std;templatet add(t a, u b){ return a + b;}templateclass c{private: t ans;public: t add(t a, t b) { ans = a + b; return ans; }};int main(){ cout
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816..
12345678910111213class Unit{ public: virtual void a() {cout
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138//CNumber.cpp#include "CNumber.h" CNumber::CNumber(){} CNumber::~CNumber(){} CNumber CNumber..
수업 전 몸풀기문제 : 가위바위보 하나 빼기1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192#include#include#includeusing namespace std;void out(int i);void check(int c, int p);int main(){//0 = 가위, 1 = 바위, 2 = 보, 가위바위보 하나 빼기 게임 srand(time(NULL)); int iP[2], iC[2], com = -1, think[3];//iP는 플..
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182#includeusing namespace std;struct Tree{ int value; Tree* pL; Tree* pR;};void Add(Tree* pNode, Tree* pNew);void Pr(Tree* pD);void Quit(Tree* pD);int main(){//이진트리(입력과 출력만 만들기) // pNewData는 트리의 추가될 노드, pHead는 트리의 헤드 노드 Tree *pNewData, *pHead = ..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798#includeusing namespace std;struct Data{ int value; Data* pNext;};int main(){ Data *pHead = NULL, *pTemp, *pTemp2; int com = 0; bool in = 0; while (1) { cout com; if (com == 1) { cout com; Data *pNewData = new D..