QUEUE.CPP
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- //THE PROGRAM IS TO TEST THE CLASS "QUEUE"
- //FILE QUEUE.CPP
- #include "QUEUE.h"
- class QUEUE : LIST
- {
- public:
- QUEUE():LIST(){}
- void PUT(int NUM)
- {
- LIST::BACKWARD_ADD(NUM);
- }
- char GET()
- {
- return LIST::GET();
- }
- };
- int main(void)
- {
- int INTNUM;
- clrscr();
- QUEUE TEXT_Q;
- printf(" --- QUEUE ---nn");
- printf("n Put 10");
- INTNUM=10;
- TEXT_Q.PUT(INTNUM);
- printf("n Put 20");
- INTNUM=20;
- TEXT_Q.PUT(INTNUM);
- printf("n Put 30");
- INTNUM=30;
- TEXT_Q.PUT(INTNUM);
- INTNUM=TEXT_Q.GET();
- printf("n THE FIRST ITEM POPPED FROM THE QUEUE = %d",INTNUM);
- INTNUM=TEXT_Q.GET();
- printf("n THE SECOND ITEM POPPED FROM THE QUEUE = %d",INTNUM);
- INTNUM=TEXT_Q.GET();
- printf("n THE THIRD ITEM POPPED FROM THE QUEUE = %d",INTNUM);
- getch();
- return 0;
- }