Skip to content

Instantly share code, notes, and snippets.

View Jack2's full-sized avatar

JAEKI KIM Jack2

View GitHub Profile
@Jack2
Jack2 / Turboc.h
Created November 14, 2012 17:19
[C++]Turboc.h
// 혼자 연구하는 C/C++의 도우미 헤더 파일
// 비주얼 C++ 환경에서 터보 C 스타일의 함수를 정의한다.
#ifndef TURBOC_HEADER
#define TURBOC_HEADER
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <windows.h>
@Jack2
Jack2 / virtual_ex.cpp
Created November 13, 2012 17:11
[C++]virtual_example
#include <iostream>
using namespace std;
class Food {
public :
virtual void SetPrice(int myprice) = 0; //순수 가상함수
int GetPrice(){
return price;
}
@Jack2
Jack2 / new_del_ex.cpp
Created November 12, 2012 16:57
[C++]new_delete_example
#include <iostream>
using namespace std;
class Jack2Box{
public :
Jack2Box(){
cout << "Jack2Box 오브젝트 생성" << endl;
}
~Jack2Box(){
@Jack2
Jack2 / func_ptr_ex.cpp
Created November 10, 2012 07:22
[C++]func_pointer_example
#include <iostream>
using namespace std;
int sum(int a,int b);
int subtract(int a,int b);
int multi(int a,int b);
int divide(int a,int b);
int(*p[4])(int x,int y) = {sum, subtract, multi, divide};
@Jack2
Jack2 / void_ptr.cpp
Created November 10, 2012 06:15
[C++]void_pointer_example
#include <iostream>
using namespace std;
void increase(void* data, int ptr_size)
{
if(ptr_size == sizeof(char))
{
char* ptr_char;
ptr_char = (char*)data;
@Jack2
Jack2 / const_ex.cpp
Created November 10, 2012 05:49
[C++]const_example(+char*)
#include <iostream>
using namespace std;
int main()
{
const char* company = "INetCop";
cout << company;
return 0;
}
@Jack2
Jack2 / ptr_ex.cpp
Created November 10, 2012 03:01
[C++]pointer_example
#include <iostream>
using namespace std;
int main()
{
int a = 10;
cout << "Value a is " << a << endl;
cout << "Value &a is " << &a << endl;
int* a_ptr = &a;
@Jack2
Jack2 / float.cpp
Created November 10, 2012 02:54
[C++]float_example (+cin.getline)
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char buffer[100];
float price;
int quantity;
@Jack2
Jack2 / class_ex.cpp
Created November 9, 2012 17:44
[C++]class_example
#include <iostream>
using namespace std;
class superstar
{
public:
char skill;
int passion;
int communication;
@Jack2
Jack2 / do_while_ex.cpp
Created November 7, 2012 15:16
[C++]do_while_example
#include <iostream>
using namespace std;
int main(){
int soo;
do{
cout << "If you want to exit then you press 1 : " ;
cin >> soo;
} while(soo != 1);