흐름제어문

흐름 제어문은 프로그램의 기본 흐름을 제어할 수 있는 문으로 break 문, continue 문, return 문이 있다.

 

(1) break문

제어문의 제어를 벗어나기 위해 사용한다.

루프가 전부 끝나지 않아도 루프에서 완전히 벗어나서 수행한다.

제어문에서 break문을 만나면 코드를 강제적으로 종료하거나 가장 가까운 제어문으로 탈출한다.

 

(2) continue

break문과 반대로 멈추지 않고 실행을 한다.

continue문은 다음 문장을 수행하지 않고 다시 제어문의 처음으로 돌아간다.

조건이 True인 경우 코드를 수행.

for문 같은 경우에는 다시 조건을 실행하고 while문 같은 경우 마지막 조건문에서 종료된다.

continue문 다음에 나오는 문장을 건너뛰게 만드는 제어문이다.

 

(3) return문

return 문은 값을 반환하며 메서드에서는 결과값을 돌려받을 수도 있다.

 

- break문 예제

int형 변수 i를 0으로 초기화.

while문의 조건 i는 10이하 실행.

출력은 i + ". 파이팅!"

i++; 로 인하여 증가 실행되며 변수값이 적용되어 실행된다.

if(i == 4) if문의 조건 i는 4까지 실행.

조건문에 일치하는 만큼 실행후 break문을 통해 실행 종료.

 

- continue문 예제

for문의 조건 int형 변수 i를 0으로 초기화. 10 미만까지 증가 실행.

if문의 조건 i/2를 통하여 나머지가 0이 나오면 True(짝수)

continue문을 통해 0이 아닌 수만(홀수) 실행하여 출력한다.

 

- return문 예제

static 키워드를 선언하면 객체를 생성하지 않고도 메서드를 호출하며 static 키워드의 의미를 공유라 생각하면 된다.

메서드에 int형 변수 a와 b를 선언.

int형 변수 result를 선언 result의 변수값은 a * b

메서드의 인자가 매개변수이므로 return문을 이용하여 result를 반환해준다.

 

 

 

 

 

'Programing > Java' 카테고리의 다른 글

객체지향의 특징 요약  (0) 2016.12.18
객체 지향 프로그래밍 이란?  (0) 2016.12.01
자바 환경변수 설정 방법  (0) 2016.12.01

상속(확장) -> sub class is a super class

슈퍼클래스를 확장시켜서 사용하는게 서브 클래스이다.

private 접근을 하지못하고 나머지는 사용 있다.



추상화(공통처리, 정의) -> 추상클래스, 인터페이스

추상클래스 : 전체중에서 일부만 추상화 시킨다.

인터페이스 : 전부 추상화 시킨다.


다형성 - 추상화를 구현


캡슐화 - has a 관계


정보은닉 - 캡슐화와 밀접한 관계

객체 지향 프로그래밍이란? 

  객체지향 프로그래밍(Object-Oriented Programming)은 좀 더 나은 프로그램을 만들기 위한 프로그래밍 패러다임으로 로직을 상태(state)와 행위(behave)로 이루어진 객체로 만드는 것이다. 이 객체들을 마치 레고 블럭처럼 조립해서 하나의 프로그램을 만드는 것이 객체지향 프로그래밍이라고 할 수 있다.

라는 너무너무너무너무 어려운 말이 적혀있다.

그래서 좀 더 쉽게 풀어서 적어보면!


객체지향프로그래밍 = 실세계 지향프로그래밍

 

실제 세계의 일부를 프로그램으로 표현할 수 있도록 만들어진 소프트웨어 개발 방식 입니다.



병원을 예로 들어보도록 하겠습니다.  

01.

객체 = 담당자 = '클래스'


- 담당자가 가지고있는 속성과 역할을 명시해놓은 추상적 정의 

실세계에서 서비스(역할)을 담당하는 것=담당자
- 객체끼리는 상호작용이 가능합니다.


ex) 병원세계

객체 : 실세계에서 원무과 직원, 의사, 간호사, 환자


02.

객체란?


추상적 정의인 클래스를 실체로 만들어 낸 것


※객체화=인스턴스화

- 클래스를 객체로 만드는 과정 입니다.


02.

클래스 멤버변수


클래스(담당자)가 반드시 가져야할 것 : Field , 멤버변수

ex) 의사는 환자의 병적을 조회하기 위해, 컴퓨터가 필요하다.

※ has a

- 멤버변수는 "클래스가 가진다"라고 표현 

- 의사 has a 청진기


03.

메소드


클래스(담당자)가 하는 역할(행동) : Method

ex) 의사가 환자를 조회한다.  

의사가 환자를 진료한다. 

의사가 처방전을 작성한다.


다음은 의사의 행동을 예로 프로그래밍을 해보도록 하겠습니다.

의사라는 클래스에서 의사의 역할(메소드)를 정의 하였습니다.



의사 클래스를 객체화 시켜 의사가 할 수 있는 역할(메소드)를 실행 하겠습니다.


결과 화면



 객체지향 프로그래밍은 개념이 매우 중요합니다. 그러기 위해서는 많은 연습이 필요한데요 각자 실세계에서 이뤄지는 상황을 보고 충분히 많은 연습을 하시면 되겠습니다.


※연습문제

1. 커피숍 바리스타가 하는 역할을

클래스와 메소드로 표현해라.


//커피숍의 커피원두를 선별한다

//고객의 주문을 받는다

//커피머신을 작동시킨다
 
//원두를 로스팅해 에스프레소를 추출한다

//주문한 커피메뉴를 제조한다 


2. 쇼핑몰에 방문한 고객의 역할

3.영화관에서 티케팅하는 사람의 역할

4. 편읜점에서 캐셔의 역할

5 병원에서 업무과 직원이 환자를 접수 시키는 과정 


1. 번과 같이 2,3,4,5번의 문제도 실세계에서 이뤄지는 과정을 최대한 자세하게 표현 해보세요~




'Programing > Java' 카테고리의 다른 글

JAVA 흐름제어문 (break문, contunue문, return문)  (0) 2018.12.12
객체지향의 특징 요약  (0) 2016.12.18
자바 환경변수 설정 방법  (0) 2016.12.01

#include "GPU_MLP.cuh"

using namespace std; 

__global__ void kernel(int **d_ptr, int width){

    d_ptr[threadIdx.y][threadIdx.x] = 3;

}

__global__ void SetDeviceMem(int *src, int **ptr, int width){

    ptr[threadIdx.x] = src + width * threadIdx.x;

}

GPU_MLP::GPU_MLP(int width, int height){

    nSize = sizeof(int* width * height;

    _width = width;

    _height = height;


    d_test = NULL;

    d_ptr = NULL;

    h_test = NULL;

    h_ptr = NULL;

    HostMemAlloc();

    DeviceMemAlloc();


    cudaMemcpy(d_test, h_test, nSize, cudaMemcpyHostToDevice);

}

void GPU_MLP::HostMemAlloc(){

    h_test = new int[_width * _height];

    h_ptr = new int*[_height]; 

    for(int i = 0; i < _height; ++i)

        h_ptr[i] = h_test + _width * i;

    memset(h_test, 0, nSize);

}

void GPU_MLP::DeviceMemAlloc(){

    cudaMalloc<int>(&d_test, nSize);

    cudaMalloc<int*>(&d_ptr, sizeof(int** _height);

    SetDeviceMem<<<1, _height>>>(d_test, d_ptr, _width);

}

void GPU_MLP::Fuction(int value){

    dim3 block(_width, _height);

    kernel<<<1, block>>>(d_ptr, _width);

    cudaMemcpy(h_test, d_test, nSize, cudaMemcpyDeviceToHost);

    for(int i = 0; i < _height; ++i){

        for(int j = 0; j < _width; ++j){

            cout << h_ptr[i][j] << " ";

        }

        cout << endl;

    }

}

GPU_MLP::~GPU_MLP(){

    delete[] h_test;

    delete[] h_ptr;

    cudaFree(d_test);

    cudaFree(d_ptr);

    cudaDeviceReset();

}

 


CUDA 파일이름.cuh

#include <iostream>

#include <cuda_runtime.h>

#include <device_launch_parameters.h>

__global__ void kernel(int **d_ptr, int width);

__global__ void SetDeviceMem(int *src, int **ptr, int width);

class GPU_MLP{


public:

    int *d_test;

    int **d_ptr;

    int *h_test;

    int **h_ptr;

    int _width;

    int _height;

    size_t nSize;

    GPU_MLP(int width, int height);

    void HostMemAlloc();

    void DeviceMemAlloc();

    void Fuction(int value);


    ~GPU_MLP();

};

 

main.cpp
#include <iostream>

#include <opencv2\opencv.hpp>

#include "GPU_MLP.cuh"

#include <Windows.h>

using namespace std;

using namespace cv;

int main(int argv, char **argc){

    GPU_MLP test(1010);

    test.Fuction(3);

    system("pause");

    return 0;

}

map과 multimap은 '연관 컨테이너'입니다. 모든 연관 컨테이너(set, multiset, map, multimap)는 '노드 기반 컨테이너'입니다. 또 모든 연관 컨테이너는 균형 2진 트리로 구현됩니다. 균형 2진 트리는 보통 레드-블랙 트리를 사용합니다. map은 key와 value의 쌍으로 구성된 데이터 셋의 집합입니다. 여기서 key는 유니크합니다. multiset도 map과 같이 key와 value의 쌍으로 구성된 데이터 셋의 집합입니다. 단, multiset은 map과 달리 중복된 key가 존재할 수 있습니다.

 


set과 map은 데이터의 key가 유니크합니다.

 


multiset과 multimap은 같은 key값의 데이터를 컨테이너에 저장할 수 있습니다.

 

map, multimap의 주요 특징과 함수

 map도 set처럼 데이터를 추가하는 push_? 류의 함수를 가지고 있지 않습니다. 삽입(insert)한다는 의미에서 insert() 함수를 가지고 있습니다.

map의 특징은 key와 value의 쌍으로 데이터를 저장합니다. 그리고 key값을 이용하여 빠르게 value값을 찾을 수 있습니다. 연관 컨테이너에서 유일하게 [] 연산자 중복을 제공합니다.

 

기본적인 map 예제

#include <iostream>
#include <map>
using namespace std;
void main( )
{
    map<int , int > m;

    m[5] = 100;
    m[3] = 50;
    m[7] = 80;
    m[2] = 100;
    m[4] = 100;

    cout << m[5] << endl;
    cout << m[3] << endl;
    cout << m[7] << endl;
    cout << m[2] << endl;
    cout << m[4] << endl;
}
  1. 100
    50
    80
    100
    100

map은 key와 value의 쌍으로 구성된 데이터들의 집합입니다. []연산자의 인덱스는 key이며 인덱스가 가리키는 메모리 값이 value입니다.

주의할 점은 m[5] = 100 연산에서 5라는 key가 없으면 노드 '추가'가되며 5라는 key가 있으면 '갱신'이 됩니다. 아래에서 공부합니다.



map의 key값 5로 value를 접근


 

 map은 key와 value의 쌍을 pair 객체로 저장합니다. STL의 쌍을 이루는 모든 요소는 pair 객체를 사용합니다.

위 예제는 insert()함수를 사용하여 아래 예제로 바꿀 수 있습니다.

#include <iostream>
#include <map>
using namespace std;
void main( )
{
    map<int , int > m;

    m.insert( pair<int,int>( 5, 100) );
    m.insert( pair<int,int>( 3, 50) );
    m.insert( pair<int,int>( 7, 80) );
    m.insert( pair<int,int>( 2, 100) );
    pair<int,intpr( 4, 100);
    m.insert( pr );

    cout << m[5] << endl;
    cout << m[3] << endl;
    cout << m[7] << endl;
    cout << m[2] << endl;
    cout << m[4] << endl;
}

  1. 100
    50
    80
    100
    100

 map은 key, value를 pair 객체로 각각 first와 second에 저장합니다.


 

 

반복자를 사용한 모든 key, value 출력 예제

#include <iostream>
#include <map>
using namespace std;

void main( )
{
    map<int , int > m;

    m[5] = 100;
    m[3] = 50;
    m[7] = 80;
    m[2] = 100;
    m[4] = 100;

    map<intint>::iterator iter;
    for( iter = m.begin(); iter != m.end() ; iter++)
        cout << "m["<<(*iter).first <<"]: " << (*iter).second << endl;

    cout << "==============" << endl;
    for( iter = m.begin(); iter != m.end() ; iter++)
        cout << "m["<<iter->first <<"]: " << iter->second << endl;
}
  1. m[2]: 100
    m[3]: 50
    m[4]: 100
    m[5]: 100
    m[7]: 80
    ==============
    m[2]: 100
    m[3]: 50
    m[4]: 100
    m[5]: 100
    m[7]: 80

 map도 양방향 반복자를 제공합니다.


 

 

연관 컨테이너는 모두 동일한 함수군을 가지며 동작 방식도 같습니다.

map의 검색 함수들입니다.

#include <iostream>
#include <map>
using namespace std;

void main( )
{
    map<int , int > m;

    m[5] = 100;
    m[3] = 50;
    m[7] = 80;
    m[2] = 100;
    m[4] = 100;

    map<intint >::iterator iter;

    iter = m.find( 5 );
    if( iter == m.end() )
        cout << "없음!" << endl;
    else
        cout << "m["<<iter->first <<"]: " << iter->second << endl;

    iter = m.lower_bound( 5 );
    if( iter == m.end() )
        cout << "없음!" << endl;
    else
        cout << "m["<<iter->first <<"]: " << iter->second << endl;

    iter = m.upper_bound( 5 );
    if( iter == m.end() )
        cout << "없음!" << endl;
    else
        cout << "m["<<iter->first <<"]: " << iter->second << endl;

    pair< map<intint>::iterator, map<intint>::iterator> iter_pair;
    iter_pair = m.equal_range(5);

    if( (iter_pair.first) == m.end() && (iter_pair.second == m.end()) )
        cout << "없음!" << endl;
    else
    {
        cout << "m["<< iter_pair.first->first <<"]: " << iter_pair.first->second <<" ~ ";
        cout << "m["<< iter_pair.second->first <<"]: " << iter_pair.second->second <<endl;
    }
}
  1. m[5]: 100
    m[5]: 100
    m[7]: 80
    m[5]: 100 ~ m[7]: 80

 동작은 set에서 설명했으므로 패스~!


 

 

 

마지막으로 multimap 예제입니다.

map과 다른 점은 [] 연산자가 없으며 key 값이 중복될 수 있습니다.

#include <iostream>
#include <map>
using namespace std;

void main( )
{
    multimap<int , int > m;

    m.insert( pair<int,int>( 5, 100) );
    m.insert( pair<int,int>( 3, 50) );
    m.insert( pair<int,int>( 7, 80) );
    m.insert( pair<int,int>( 2, 100) );
    m.insert( pair<int,int>( 4, 100) );
    m.insert( pair<int,int>( 7, 200) );
    m.insert( pair<int,int>( 7, 300) );

    pair<multimap<int,int>::iterator, multimap<intint>::iterator > iter_pair;
    iter_pair = m.equal_range( 7 );
    multimap<int,int>::iterator iter;
    for( iter = iter_pair.first ; iter != iter_pair.second ; iter++)
        cout << "m["<< iter->first <<"]: " << iter->second <<' ';
    cout << endl;

}
  1. m[7]: 80 m[7]: 200 m[7]: 300

 설명은 multiset과 같습니다.


'Programing > 자료구조' 카테고리의 다른 글

STL find함수 사용  (0) 2016.12.01
이중연결리스트 노드 cpp  (0) 2016.12.01
이중연결리스트 노드클래스  (0) 2016.12.01
이중연결리스트.cpp  (0) 2016.12.01
단일연결리스트.cpp  (0) 2016.11.30

InIt find(InIt first, InIt last, const T& val);


ex)

#include <iostream>

#include <string>

#include <vector>

#include <algorithm>

using namespace std;

 

void main()

{

     string names[]={"김정수","구홍녀","문병대",

          "김영주","임재임","박미영","박윤자"}

;

     vector<string> as(&names[0],&names[7]);

 

     vector<string>::iterator it;

     it=find(as.begin(),as.end(),"안순자");

     if (it==as.end()) {

          cout << "없다" << endl;

     } else {

          cout << "있다" << endl;

     }

}




InIt find_if(InIt first, InIt last, UniPred F);


ex)

#include <iostream>

#include <string>

#include <vector>

#include <algorithm>

using namespace std;

 

bool HasYoung(string who)

{

     return (who.find("영") != string::npos);

}

 

void main()

{

     string names[]={"김정수","구홍녀","문병대",

          "김영주","임재임","박미영","박윤자"};

     vector<string> as(&names[0],&names[7]);

 

     vector<string>::iterator it;

     for (it=as.begin();;it++) {

          it=find_if(it,as.end(),HasYoung);

          if (it==as.end()) break;

          cout << *it << "이(가) 있다." << endl;

     }

}




FwdIt adjacent_find(FwdIt first, FwdIt last [, BinPred F]);

ex)

#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

 

void main()

{

     int ari[]={1,9,3,6,7,5,5,8,1,4};

     vector<int> vi(&ari[0],&ari[9]);

 

     vector<int>::iterator it;

     it=adjacent_find(vi.begin(),vi.end());

     if (it != vi.end()) {

          printf("두 요소가 인접한 값은 %d입니다.\n",*it);

     }

}


FwdIt1 find_first_of(FwdIt1 first1, FwdIt1 last1, FwdIt2 first2, FwdIt2 last2 [, BinPred F]);

ex)

#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

 

void main()

{

     int ar1[]={3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4,3};

     int ar2[]={2,4,6,8,0};

 

     int *p=find_first_of(&ar1[0],&ar1[25],&ar2[0],&ar2[4]);

     if (p!=&ar1[25]) {

          printf("최초의 짝수는 %d번째의 %d입니다.\n",p-ar1,*p);

     }



'Programing > 자료구조' 카테고리의 다른 글

STL 컨터이네(map,multimap)  (0) 2016.12.01
이중연결리스트 노드 cpp  (0) 2016.12.01
이중연결리스트 노드클래스  (0) 2016.12.01
이중연결리스트.cpp  (0) 2016.12.01
단일연결리스트.cpp  (0) 2016.11.30
#include "Node.h"

Node::Node(int num, Node *n,Node*p)
{
data = num;
next = n;
prev = p;

}
Node::Node(int num)
{

data = num;
next = NULL;
prev = NULL;
}
Node *Node::getPrev()
{
return prev;
}
Node * Node::getNext()
{
return next;
}

void Node::setNext(Node *n)
{
next = n;
}
void Node::setPrev(Node *p)
{
prev = p;
}

int Node::get_data()
{
return data;
}
void Node::set_data(Node *p)
{
data = p->data;
}


'Programing > 자료구조' 카테고리의 다른 글

STL 컨터이네(map,multimap)  (0) 2016.12.01
STL find함수 사용  (0) 2016.12.01
이중연결리스트 노드클래스  (0) 2016.12.01
이중연결리스트.cpp  (0) 2016.12.01
단일연결리스트.cpp  (0) 2016.11.30
#pragma once

#include <iostream>
class Node
{
private :
int data;
Node *prev;
Node *next;
public :
Node(int num, Node *n,Node* p);
Node(int num);

Node * getNext();
Node * getPrev();
int get_data();

void setNext(Node *n);
void setPrev(Node *p);
void set_data(Node *p);
};


'Programing > 자료구조' 카테고리의 다른 글

STL find함수 사용  (0) 2016.12.01
이중연결리스트 노드 cpp  (0) 2016.12.01
이중연결리스트.cpp  (0) 2016.12.01
단일연결리스트.cpp  (0) 2016.11.30
단일연결리스트.h  (0) 2016.11.30

/*****************************************************************************
*  ------------------------------- dlist.c --------------------------------  *
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include "dlist.h"
/*****************************************************************************
*  ------------------------------ dlist_init ------------------------------  *
*****************************************************************************/
void dlist_init(DList *list, void (*destroy)(void *data)) {
 /*****************************************************************************
 *  Initialize the list.                                                      *
 *****************************************************************************/
 list->size = 0;
 list->destroy = destroy;
 list->head = NULL;
 list->tail = NULL;
 return;
}
/*****************************************************************************
*  ---------------------------- dlist_destroy -----------------------------  *
*****************************************************************************/
void dlist_destroy(DList *list) {
 void               *data;
 /*****************************************************************************
 *  Remove each element.                                                      *
 *****************************************************************************/
 while (dlist_size(list) > 0) {
  if (dlist_remove(list, dlist_tail(list), (void **)&data) == 0 && list->
   destroy != NULL) {
    /***********************************************************************
    *  Call a user-defined function to free dynamically allocated data.    *
    ***********************************************************************/
    list->destroy(data);
  }
 }
 /*****************************************************************************
 *  No operations are allowed now, but clear the structure as a precaution.   *
 *****************************************************************************/
 memset(list, 0, sizeof(DList));
 return;
}
/*****************************************************************************
*  ---------------------------- dlist_ins_next ----------------------------  *
*****************************************************************************/
int dlist_ins_next(DList *list, DListElmt *element, const void *data) {
 DListElmt          *new_element;
 /*****************************************************************************
 *  Do not allow a NULL element unless the list is empty.                     *
 *****************************************************************************/
 if (element == NULL && dlist_size(list) != 0)
  return -1;
 /*****************************************************************************
 *  Allocate storage for the element.                                         *
 *****************************************************************************/
 if ((new_element = (DListElmt *)malloc(sizeof(DListElmt))) == NULL)
  return -1;
 /*****************************************************************************
 *  Insert the new element into the list.                                     *
 *****************************************************************************/
 new_element->data = (void *)data;
 if (dlist_size(list) == 0) {
  /**************************************************************************
  *  Handle insertion when the list is empty.                               *
  **************************************************************************/
  list->head = new_element;
  list->head->prev = NULL;
  list->head->next = NULL;
  list->tail = new_element;
 }
 else {
  /**************************************************************************
  *  Handle insertion when the list is not empty.                           *
  **************************************************************************/
  new_element->next = element->next;
  new_element->prev = element;
  if (element->next == NULL)
   list->tail = new_element;
  else
   element->next->prev = new_element;
  element->next = new_element;
 }
 /*****************************************************************************
 *  Adjust the size of the list to account for the inserted element.          *
 *****************************************************************************/
 list->size++;
 return 0;
}
/*****************************************************************************
*  ---------------------------- dlist_ins_prev ----------------------------  *
*****************************************************************************/
int dlist_ins_prev(DList *list, DListElmt *element, const void *data) {
 DListElmt          *new_element;
 /*****************************************************************************
 *  Do not allow a NULL element unless the list is empty.                     *
 *****************************************************************************/
 if (element == NULL && dlist_size(list) != 0)
  return -1;
 /*****************************************************************************
 *  Allocate storage to be managed by the abstract data type.                 *
 *****************************************************************************/
 if ((new_element = (DListElmt *)malloc(sizeof(DListElmt))) == NULL)
  return -1;
 /*****************************************************************************
 *  Insert the new element into the list.                                     *
 *****************************************************************************/
 new_element->data = (void *)data;
 if (dlist_size(list) == 0) {
  /**************************************************************************
  *  Handle insertion when the list is empty.                               *
  **************************************************************************/
  list->head = new_element;
  list->head->prev = NULL;
  list->head->next = NULL;
  list->tail = new_element;
 }
 else {
  /**************************************************************************
  *  Handle insertion when the list is not empty.                           *
  **************************************************************************/
  new_element->next = element; 
  new_element->prev = element->prev;
  if (element->prev == NULL)
   list->head = new_element;
  else
   element->prev->next = new_element;
  element->prev = new_element;
 }
 /*****************************************************************************
 *  Adjust the size of the list to account for the new element.               *
 *****************************************************************************/
 list->size++;
 return 0;
}
/*****************************************************************************
*  ----------------------------- dlist_remove -----------------------------  *
*****************************************************************************/
int dlist_remove(DList *list, DListElmt *element, void **data) {
 /*****************************************************************************
 *  Do not allow a NULL element or removal from an empty list.                *
 *****************************************************************************/
 if (element == NULL || dlist_size(list) == 0)
  return -1;
 /*****************************************************************************
 *  Remove the element from the list.                                         *
 *****************************************************************************/
 *data = element->data;
 if (element == list->head) {
  /**************************************************************************
  *  Handle removal from the head of the list.                              *
  **************************************************************************/
  list->head = element->next;
  if (list->head == NULL)
   list->tail = NULL;
  else
   element->next->prev = NULL;
 }
 else {
  /**************************************************************************
  *  Handle removal from other than the head of the list.                   *
  **************************************************************************/
  element->prev->next = element->next;
  if (element->next == NULL)
   list->tail = element->prev;
  else
   element->next->prev = element->prev;
 }
 /*****************************************************************************
 *  Free the storage allocated by the abstract data type.                     *
 *****************************************************************************/
 free(element);
 /*****************************************************************************
 *  Adjust the size of the list to account for the removed element.           *
 *****************************************************************************/
 list->size--;
 return 0;
}



'Programing > 자료구조' 카테고리의 다른 글

이중연결리스트 노드 cpp  (0) 2016.12.01
이중연결리스트 노드클래스  (0) 2016.12.01
단일연결리스트.cpp  (0) 2016.11.30
단일연결리스트.h  (0) 2016.11.30
이중연결리스트  (0) 2016.11.30

< JAVA 설치하기 >


- 오라클홈페이지 Java SE Development Kit  (JDK) 다운로드


- JDK = Java, JVM(가상머신)

  윈도우, 리눅스, 맥 등 어느 운영체제든 실행이 가능한 이유는?  JVM


1. 시스템 변수에 jdk 경로를 추가 시킵니다.



2. Path에 시스템 변수에서 추가시킨 jdk 경로를 입력해주면 끝.





이제 cmd 창에서 잘 설치가 되었는지 확인하도록 하겠습니다.

< cmd 실행방법 >


1. 윈도우R - cmd 

java -version

 javac -version


위 화면과 같이 나오면 최초 환경변수 설정은 끝났습니다~

'Programing > Java' 카테고리의 다른 글

JAVA 흐름제어문 (break문, contunue문, return문)  (0) 2018.12.12
객체지향의 특징 요약  (0) 2016.12.18
객체 지향 프로그래밍 이란?  (0) 2016.12.01

+ Recent posts