올린글을 확인할 수 있도록 포스팅을 공개로 설정해 주세요.
자료구조 - stack과 queue

INDEX

1.목적
2.소스코드
3.이용한 함수
4.출력결과
5.정리

1.목적
정수값을 입력한 정수의 개수대로 임의로 받아 큐에 enqueue,dequeue 하여 출력값을 txt 파일에 출력한다. 다시 같은 값을 스택에 push 한 후, 다시 pop 하여 그 값들이 역순으로 txt 파일로 출력되도록 한다.
2.소스코드

헤더파일1 //ArrayBaseStack.h
#ifndef __AB_STACK_H__
#define __AB_STACK_H__

#define TRUE 1
#define FALSE 0
#define STACK_LEN 100

typedef int Data;

typedef struct _arrayStack
{
Data stackArr[STACK_LEN];
int topIndex;
}ArrayStack;
typedef ArrayStack Stack;
void StackInit(Stack * pstack);
int SIsEmpty(Stack * pstack);

void SPush(Stack * pstack,Data data);
Data SPop(Stack *pstack);
Data SPeek(Stack *pstack);

#endif
헤더파일2//CircularQueue.h
#ifndef __c_QUEUE_H__
#define __c_QUEUE_H__

#define TRUE 1
#define FALSE 0
#define QUE_LEN 1000
typedef int Data;

typedef struct _cQueue
{
int front;
int rear;
Data queArr[QUE_LEN];
}CQueue;

typedef CQueue Queue;

void QueueInit(Queue * pq);
int QIsEmpty(Queue * pq);

void Enqueue(Queue * pq,Data data);
Data Dequeue(Queue * pq);
....

[hwp/pdf]자료구조 - stack과 queue
포스팅 주소 입력
  올린글을 확인할 수 있는 포스팅 주소를 입력해 주세요.
  네이버,다음,티스토리,스팀잇,페이스북,레딧,기타 등 각각 4개(20,000p) 까지 등록 가능하며 총 80,000p(8,000원)까지 적립이 가능합니다.