// bfsdfs.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" class Queue { public: Queue() : sp(0), count(0) { } void Put(int x) { data[(sp+count)%128] = x; count++; } int Get() { int x = data[sp]; sp = (sp+1)%128; count--; return x; } bool lsEmpty() { return count == 0; } private: int sp, count; int data[128]; }; int adj[8][8] = { { 0, 0, 1, 1, 0, 0, 0, 0 }, { 1, 0, 1, 0, 0, 0, 0, 0 }, { 1..
// searchtree.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // // 삽입 트리 #include "stdafx.h" struct Node { int key; //int recidx; // key == x ) return t; if( t->key right, x); return searchTree(t->left, x); } // 재귀를 사용한 노드 삽입 // 특징 : 반환값이 존재한다. Node *insertTreeRecursive(Node *t, int x) { // case 1 : 루트값이 NULL인 경우 if( t == NULL ) { Node *r = new Node; r->key = x; r->left = r->right =..
// Fibonacci.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // // 중복호출을 허용한 경우 #include "stdafx.h" int count = 0; // 호출횟수 저장용 int fib(int n) { count++; if( n == 1 || n == 2 ) return 1; return fib(n-1)+fib(n-2); } int _tmain(int argc, _TCHAR* argv[]) { int n; while( 1 ) { scanf("%d", &n); if( n == 0 ) break; count = 0; printf("fib(%d) = %d\n", n, fib(n)); printf("Total call count = %d\n", count); } return 0; }..
// LinkedStack.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" // 단일 포인터 이용 struct Node { int data; Node *next; }; Node *head = 0; void Push(int r) { Node *p = new Node; p->data = r; p->next = head; head = p; } int Pop() { Node *p = head; head = p->next; int r = p->data; delete p; return r; } int _tmain(int argc, _TCHAR* argv[]) { for( int i = 1; i data = r; p->next = *head; *head = p; }..
// quickSort.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" void swap(int &x, int &y) { int t = x; x = y; y = t; } // 데이터를 기준값을 기준으로 두개의 블록으로 나눈다. // A[] [IN] 나눌 데이터 // p [IN] 데이터의 첫번째 인덱스 // r [IN] 데이터의 마지막 인덱스 // return [OUT] 기준원소가 위치한 배열 인덱스 int partition(int A[], int p, int r) { // i : 기준값보다 작은 데이터가 들어갈 곳 // j : 배열을 처음부터 마지막까지 찾아봄 // pivot : 기준 데이터 int i = p; int j = p; int pivot = ..
// mergeSort.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" // A[] [IN] 데이터가 저장되어 있는 배열 // p [IN] 병합을 수행할 첫번째 인덱스 // r [IN] 병합을 수행할 오른쪽 블록의 첫번째 인덱스 // q [IN] 병합을 수행할 마지막 인덱스 void merge(int A[], int p, int r, int q) { int i, j; // i : 왼쪽 블록, j : 오른쪽 블록 i = p; j = r; // 병합하기 위해서 새로운 배열 생성 int k = 0; // 병합된 결과 배열의 인덱스 int B[100]; // 병합된 결과 배열 while( i < r && j
Microsoft Visual Studio 2005 버전으로 작성되었습니다.. 미리 컴파일 된 헤더를 사용했습니다.. 삽입 정렬.. #include "stdafx.h" #include // A[] : 데이터 배열 // n : 데이터 갯수 // A[0..n] 배열을 정렬한다. // 비주얼 요소 추가 void Display(int A[], int n); void insertionSort(int A[], int n, int i) { if( i == n ) return; int j = i; int tmp = A[i]; // 비교대상 값을 tmp 저장 while( A[j-1] > tmp && j > 0 ) // 바로 앞 배열의 값과 tmp 값 비교 { A[j] = A[j-1]; // 앞 배열의 값이 크면 한칸 이..
전에 한번 썼는데.. 색 넣기가 귀찮아서;.. 그냥 그대로 넣습니다.. Microsoft Visual Studio 2005 버전으로 작성되었습니다.. 미리 컴파일 된 헤더를 사용했습니다.. 선택 정렬.. #include "stdafx.h" #include // A[] : 데이터 배열 // n : 데이터 갯수 // A[0..n] 배열을 정렬한다. // 비쥬얼 요소 추가 void Display(int A[], int n); void selectionSort(int A[], int n) { for(int last=n-1; last>=1; last--) { // A[0..last] 중 가장 큰 수 A[k]를 찾는다. int k=0; for(int i=1; i
Microsoft Visual Studio 2005 버전으로 작성되었습니다.. 미리 컴파일 된 헤더를 사용했습니다.. // ArrayTest.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" // 여러개의 변수를 한번에 선언하는 방법 : 배열(Array) // int n1, n2, n3, n4, n5, n6, n7, n8, n9, n10; // 여러개의 변수를 선언해줄려면 변수선언을 일일이 해주어야하는 번거로움 존재 // int n[10]; // 배열변수의 선언은 여러개의 변수를 한번에 선언해줄 수 있다. // 배열변수는 첨자가 1부터 시작하지 않고 0부터 시작한다는 것에 주의한다. // 예를 들어서, // int n[3]; 은 // int n[0], n..
워크래프트3 1.23 맵핵입니다.. 만드신 분이 C++ 로 작성을 했네요.. 공부하시는 분들을 위해.. 올려봤습니다.. //SimpleWc3Hack for Warcraft 3 Patch 1.23... #include #include #include using namespace std; DWORD GetPIDForProcess (char* process); void EnableDebugPriv(); DWORD GetDLLBase(char* DllName, DWORD tPid); #define PATCH(i,w,l) WriteProcessMemory(hProc, reinterpret_cast(gameBase+i),w,l,&dSize) #define NPATCH(i,w,l) WriteProcessMemory(..
//싱글톤 클래스 #include "stdafx.h" #include class A { public: static A *Create(); static A *GetSingleTone() { return ms_pkThis; } private: static A *ms_pkThis; }; A *A::Create() { if ( ms_pkThis ) return ms_pkThis; // ms_pkThis 있으면 반환 없으면 새로 생성 ms_pkThis = new A; return ms_pkThis; } A *A::ms_pkThis = 0; int _tmain(int argc, _TCHAR* argv[]) { A *p = A::Create(); printf("Addr : %x\n" ,p); p = A::Create..
// create 함수 #include "stdafx.h" #include // 노출시킬 A 클래스 class A { public: static A *Create(); virtual void foo() = 0; // 순수 가상 클래스 }; // 노출시키지 않을 B, C 클래스 class B : public A { public: virtual void foo() { printf("B->foo()\n"); } }; class C : public A { public: virtual void foo() { printf("C->foo()\n"); } }; int env = 0; // 0 이면 B 클래스를 조건, 1 이면 C 클래스 조건 A *A::Create() { if ( env == 0 ) return new..
#include "stdafx.h" #include class A { public: A() { printf("A 오브젝트 생성\n"); } // 생성자 ~A() { printf("A 오브젝트 소멸\n"); } // 소멸자 void foo() { printf("A->foo()\n"); } }; class B : public A // B 클래스는 A 클래스를 상속 { public: B() { printf("B 오브젝트 생성\n"); } ~B() { printf("B 오브젝트 소멸\n"); } void foo() { printf("B->foo()\n"); } // A 클래스를 상속 }; int _tmain(int argc, _TCHAR* argv[]) { A a; // 클래스 A 오브젝트 생성 ( 생성자 호출..
// 이중 링크드 리스트 구성 Microsoft Visual Studio 2005 // LinkedList.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" struct DList { int data; DList *prev; DList *next; }; // 빈 노드 설정 DList root = { 0, &root, &root }; // (prev -> root root -> root next -> tmp -> tmp prev -> root -> root prev -> tmp { DList *tmp = new DList; tmp->data = data; tmp->prev = &root; tmp->next = root.next; root.next->prev..
// 단일 링크드 리스트 구성 Microsoft Visual Studio 2005 // LinkedList.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" struct SList { int data; SList *next; // 다음 링크 포인터 }; // 단일 링크드 리스트의 해드(head) SList *head = NULL; // data란 값으로 새로운 노트를 리스트에 추가한다. void Insert(int data) // head -> 추가위치(next tmp) -> NULL { SList *tmp = new SList; tmp->data = data; tmp->next = head; head = tmp; } // 첫번째 노드를 삭제한다. SLi..
List.h #if !defined(AFX_LIST_H__1AAF7FC2_D6C4_4EB1_9396_379E52798202__INCLUDED_) #define AFX_LIST_H__1AAF7FC2_D6C4_4EB1_9396_379E52798202__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif// _MSC_VER > 1000 struct sNODE { int nData; sNODE *pNext; }; class CList { public: CList(); virtual ~CList(); void Insert(int nData); int GetAt(int nIndex); // void Print(int nIndex); // int Find(int nData); i..
Queue.h // Queue.h: interface for the CQueue class. ////////////////////////////////////////////////////////////////////// #if !defined(AFX_QUEUE_H__53C50204_BCF9_45DF_8A69_7BA4AC7AB4FD__INCLUDED_) #define AFX_QUEUE_H__53C50204_BCF9_45DF_8A69_7BA4AC7AB4FD__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define MAXQ 10 #define EMPTY -98384 class CQueue { public: CQueue(); vi..
Stack.h // Stack.h: interface for the CStack class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_STACK_H__EC159708_EAB9_4CD6_BAC2_4312A0F48F05__INCLUDED_) #define AFX_STACK_H__EC159708_EAB9_4CD6_BAC2_4312A0F48F05__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define MAX_STACK 10 #define STACK_EMPTY -99999 class CStack { public..
------------------------------------------------------------------------------------------------------- 컴퓨터 용어 관련 텀즈 코리아 김동근의 텀즈 컴퓨터 용어사전 - http://terms.co.kr/ http--www.hardwarecentral.com- - http://www.hardwarecentral.com/hardwarecentral/ Computer Dictionary for Computer and Internet Terms and Definitions - http://www.webopedia.com/ -------------------------------------------------------------..
//삼각형 그리기 응용 Microsoft Visual Studio 2005 // rainbow.cpp : 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" #include "rainbow.h" #include // direct 3d를 사용하기 위한 헤더파일 #include // direct 3d에서 제공하는 유틸리티 함수를 위한 헤더파일 #define MAX_LOADSTRING 100 #define D3DFVF_CUSTOM D3DFVF_XYZRHW | D3DFVF_DIFFUSE struct CustomVertex { float x, y, z, rhw; //정점의 위치 DWORD diffuse; //정점의 색 }; // 전역 변수 HINSTANCE hInst; // 현재 ..
//삼각형 그리기 Microsoft Visual Studio 2005 // simpletriangle.cpp : 응용 프로그램에 대한 진입점을 정의합니다. // #include "stdafx.h" #include "simpletriangle.h" #include // direct 3d를 사용하기 위한 헤더파일 #include // direct 3d에서 제공하는 유틸리티 함수를 위한 헤더파일 #define MAX_LOADSTRING 100 #define D3DFVF_CUSTOM D3DFVF_XYZRHW | D3DFVF_DIFFUSE struct CustomVertex { float x, y, z, rhw; //정점의 위치 DWORD diffuse; //정점의 색 }; // 전역 변수: HINSTANCE h..
- Total
- Today
- Yesterday
- ndsl
- Wii GAME
- jsp
- 3분 영어 위클리
- 겨울
- 2011사진공모전
- DLC
- 게시판
- 티스토리달력2011
- NDS
- 야생의 숨결
- 웃기는 사진
- NDSi
- 동물의숲
- Project Diet
- oracle
- 슈퍼마리오 RPG
- Free Coupon
- NDS GAME LIST
- 오라클
- 젤다의 전설
- CNN Student News
- 동유럽
- 스포어
- 티스토리달력2010
- 군대이야기
- 가을
- 아이폰
- Spore
- C/C++
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |