''탈주자로 인하여 잠수함이 못내려가요. ~~더 무거워져야 될텐데..~~'' [[TableOfContents]] = 참여자 명단 = || 함장 || 장용운 || 11학번 || 도스마스 || ||<|7> 선원 || 천준현 ||<|7> 15학번 || 행방불명 || || 최지혁 || 출석 || || 박인서 || 도스마스 || || 이정재 || 고향 || || 이원준 || 출석 || || 조종현 || 장염 || || 남헌 || 도스마스 || = 수업 = == 진행 == 1. 장소 : 6층 학회실 2. 시간 : 14시 ~ 17시 == 내용 == '''보충. 스택과 큐 연습''' * 은행 관리 프로그램 ~~탈주자들 안오면 잘라버리자~~ = 코드 = == 예제1 == * 큐를 이용하여 은행에 저장된 사람이름, 계좌번호, 잔액을 입력받은 순서대로 나오게 작성하시오. == 예제2 == * 스택을 이용하여 은행에 저장된 사람이름, 계좌번호, 잔액을 입력받은 순서의 반대로 나오게 작성하시오. = 숙제 = 1. 스택과 큐 복습하기 ---- = 숙제 제출 = == 천준현 == == 최지혁 == == 박인서 == === 예제1 === {{{ #include #include typedef struct bank{ int money; int num; char * name; }bank; typedef struct node{ bank val; struct node* next; }node; void push(node *); void pop(node *); int main() { node head; int i; head.next=NULL; for(i=0;i<10;i++) push(&head); for(i=0;i<10;i++) pop(&head); return 0; } void push(node * target) { node * newnode=(node *)malloc(sizeof(node)); node * temp=target->next; int tmoney,tnum; char * tname=(char *)malloc(sizeof(char)*100); scanf("%s %d %d",tname,&tnum,&tmoney); newnode->val.name=tname; newnode->val.num=tnum; newnode->val.money=tmoney; target->next=newnode; newnode->next=temp; } void pop(node * target) { node * kill=(node *)malloc(sizeof(node)); if(target==NULL) abort(); if(target->next->next==NULL) { printf("%s %d %d\n",target->next->val.name,target->next->val.num,target->next->val.money); kill=target->next; target->next=NULL; free(kill); } else pop(target->next); } }}} === 예제2 === {{{ #include #include typedef struct bank{ int money; int num; char * name; }bank; typedef struct node{ bank val; struct node* next; }node; void push(node *); void pop(node *); int main() { node head; int i; head.next=NULL; for(i=0;i<10;i++) push(&head); for(i=0;i<10;i++) pop(&head); return 0; } void push(node * target) { node * newnode=(node *)malloc(sizeof(node)); node * temp=target->next; int tmoney,tnum; char * tname=(char *)malloc(sizeof(char)*100); scanf("%s %d %d",tname,&tnum,&tmoney); newnode->val.name=tname; newnode->val.num=tnum; newnode->val.money=tmoney; target->next=newnode; newnode->next=temp; } void pop(node * target) { node * kill = target->next; printf("%s %d %d\n",target->next->val.name,target->next->val.num,target->next->val.money); if(target->next==NULL) abort(); target->next=target->next->next; free(kill); } }}} == 이정재 == == 이원준 == == 조종현 == == 남헌 == ---- ----------------------------------- [활동지도/2015] [자료구족발보쌈]