>>> b = []
>>> e = []

>>> def main():

global c
print '*'*34
print '* Stack is First input Last Out *'
print '* Queue is First input First Out *'
print '*'*34
print '1. Insert Stack'
print '2. Delete Stack'
print '3. Show Stack'
print '4. Insert Queue'
print '5. Delete Queue'
print '6. Show Queue'
print '7. EXIT'
print 'Do you choice Number = ',
c = raw_input()
if c == '1':
insert_stack()
elif c == '2':
delete_stack()
elif c == '3':
recent_stack()
elif c == '4':
insert_queue()
elif c == '5':
delete_queue()
elif c == '6':
recent_queue()
else:
ex()


>>> def insert_stack():
print 'Insert to the Stack'
a = raw_input('-->')
b.append(a)
main()


>>> def delete_stack():
d = len(b) - 1
del b[d:]
print 'Last Stack Delete'
print 'Recent Stack is ',
print b
main()


>>> def recent_stack():
print 'Recent Stack'
print b
main()

>>> def insert_queue():
print 'Insert to the Queue'
a = raw_input('-->')
e.append(a)
main()


>>> def delete_queue():
del e[0]
print 'First Queue Delete'
print 'Recent Queue is',
print e
main()


>>> def recent_queue():
print 'Recent Queue'
print e
main()


>>> def ex():
pass

//--- 프로그램 작성 완료



//--------- 실행 예제

>>> main()
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 1
Insert to the Stack
-->222
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 1
Insert to the Stack
-->333
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 3
Recent Stack
['222', '333']
**********************************
* Stack is First input Last Out *
* Queue is First input First Out *
**********************************
1. Insert Stack
2. Delete Stack
3. Show Stack
4. Insert Queue
5. Delete Queue
6. Show Queue
7. EXIT
Do you choice Number = 7
>>>
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2008/05/27 11:38 2008/05/27 11:38
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/3301

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/3301

« Previous : 1 : ... 499 : 500 : 501 : 502 : 503 : 504 : 505 : 506 : 507 : ... 1009 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/11   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Statistics Graph

Site Stats

Total hits:
244522
Today:
873
Yesterday:
776