목차
- 프로그램소스
- 결과화면 캡쳐
- 결과화면 캡쳐
본문내용
it;
stack_pointer temp = (stack_pointer)malloc(sizeof(stack));
if(IS_FULL(temp))
{
printf(\"The memory is full.\\n\");
exit(1);
}
printf(\"PUSH DATA:: \");
scanf(\"%s\",&it);
temp->item = it;
temp->link= *top;
*top = temp;
}
void delete(stack_pointer *top)
{
stack_pointer temp = *top;
char ditem;
if(IS_EMPTY(temp))
{
printf(\"The stack is empty. \\n\");
}
ditem = temp->item;
*top = temp->link;
free(temp);
printf(\"POP DATA : %c\\n\",ditem);
}
void state(stack_pointer *top)
{
stack_pointer temp = *top;
printf(\"지금 상태 :\\n\");
while(temp)
{
printf(\"%C\\n\",temp->item);
temp=temp->link;
}
}
main()
{
int a; /* 입력 값을 받을 변수*/
while(1)
{
printf(\" 1.PUSH 2.POP 3.현재상태\\n\");
scanf(\"%d\", &a);
if(a == 1)
add(top);
else if(a == 2)
delete(top);
else if(a == 3)
state(top);
else
printf(\"잘못 입력하셨습니다.\\n\");
}
return(0);
}
stack_pointer temp = (stack_pointer)malloc(sizeof(stack));
if(IS_FULL(temp))
{
printf(\"The memory is full.\\n\");
exit(1);
}
printf(\"PUSH DATA:: \");
scanf(\"%s\",&it);
temp->item = it;
temp->link= *top;
*top = temp;
}
void delete(stack_pointer *top)
{
stack_pointer temp = *top;
char ditem;
if(IS_EMPTY(temp))
{
printf(\"The stack is empty. \\n\");
}
ditem = temp->item;
*top = temp->link;
free(temp);
printf(\"POP DATA : %c\\n\",ditem);
}
void state(stack_pointer *top)
{
stack_pointer temp = *top;
printf(\"지금 상태 :\\n\");
while(temp)
{
printf(\"%C\\n\",temp->item);
temp=temp->link;
}
}
main()
{
int a; /* 입력 값을 받을 변수*/
while(1)
{
printf(\" 1.PUSH 2.POP 3.현재상태\\n\");
scanf(\"%d\", &a);
if(a == 1)
add(top);
else if(a == 2)
delete(top);
else if(a == 3)
state(top);
else
printf(\"잘못 입력하셨습니다.\\n\");
}
return(0);
}
추천자료
8051 어셈블러를 이용한 시리얼 PC 통신
블루투스[Bluetooth]기술의 미래
연료전지자동차 (Fuel Cell Vehicles)
UPnP에 대하여
[C언어] 구조체를 이용한 세븐포커 프로그램 소스
블루투스 프로토콜 분석
자료구조 관련
OSI7-Layer 프로토콜의 7개 계층을 제시하고 각 계층이 수행하는 역할을 설명하고, 실제 인터...
이동통신사 결합요금제 불편완화 프로젝트
AVR 초음파센서 카트
홈네트워크간결요약및향후전략
[유비쿼터스컴퓨팅개론 공통] 현재 스마트폰에서 사용되는 안드로이드 롤리팝 운영체제의 특...
[사물인터넷] 사물인터넷의 사례와 전망 ; 사물인터넷의 적용분야 분석
소개글