#include<iostream.h> #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<process.h> #define maxsize 5 struct que { int items[maxsize]; int rear , front; }; void insert(struct que *,int); int remove(struct que *) ; int empty (struct que *); void makenull(struct que *); void front(struct que *); /****************** insert function **********************/ void insert(struct que *q,int a) { if(q->rear==maxsize-1) q->rear=0; else (q->rear)++ ; if(q->rear==q->front) { cout<<endl<<"OVERFLOW" <<endl ; //exit(1); } q->items[q->rear]=a ; } /*************** remove function ********************/ int remove(struct que *q) { if(empty(q)) { cout<<endl<<" UNDERFLOW"<<endl; } if(q->front==maxsize-1) q->front =0; else { (q->front)++; } return (q->items[q->front]); q->rear=q->front=maxsize-1; } /********************** empty function ************************/ int empty(struct que *q) { if(q->front==q->rear) return (1); else return (0); } /********************* front function ******************************/ //returns the 1st element in queue void front(struct que *q) { int a; int first_val; first_val=q->items[q->front]; cout<<endl<<"FIRST ELEMENT IS :" <<first_val; } /******************** makenull function ***************************/ void makenull(struct que *q) { if(empty(q)) { cout<<"THE QUEUE IS EMPTY"; } else { q->rear=q->front=maxsize-1; cout<<endl<<"QUEUE Is EMPTY "<<endl ; } } /****************** main function *****************************/ void main () { int a; clrscr(); struct que *q; for(int i=0;i<maxsize;i++) q->items[i]=0; char choice; q->rear=q->front=maxsize-1; cout<<endl<<"******************* IMPLIMENTATION OF QUEUES******************" <<endl<<endl; do { //clrscr(); cout<<endl<<endl<<" 1 : Insert "<<endl<<" 2 : Remove "<<endl<<" 3 : check empty : 0 shows not empty & 1 shows empty " <<endl<<" 4 : Makenull"<<endl<<" 5 : Front"<<endl; cout<< "enter ur choice : " ; choice=getche(); switch(choice) { case '1' : { cout<<endl<<"ENTER THE VALUE : "; cin>>a; insert(q,a); for(int i=0; i<=maxsize-2;i++) cout<<q->items[i]<<" "; break; } case '2' : { cout<<endl<<"THE VALUE IS: "; cout<<remove(q)<<endl; for(int i=maxsize-1;i>0;i--) cout<<q->items[i]<<" "; break; } case '3' : { cout<<endl<<empty(q); break; } case '4' : { makenull(q); for(int i=0;i<maxsize;i++) { q->items[i]='\0'; cout<<q->items[i]<<endl; } break; } case '5': { front(q); break; } default : cout<<" wrong choice "; break; }//end of switch cout<<endl<<"Do u want to exit y/n :" ; } //end do while while((choice=getche())!='y'); }//end main
Kamis, 17 November 2011
0 Program Queue C++
Langganan:
Posting Komentar (Atom)
Search
*Free SMS*
*Map Online*
Followers
*Clock*
Blog Archieve
-
▼
2011
(80)
-
▼
November
(34)
- [Free] Audition Ayodance Hack
- Visual PointBlank Versi 08 Special AKurasi + Wallh...
- Menyisipkan musik autoplay di blog
- Updates PointBlank gravity + ALl Weapon brutal + R...
- Visual Versi 07 Special Wallshot penggati Wallhack...
- One Hit Sg
- Updates PointBlank gravity + ALl Weapon brutal + R...
- Installasi Custom Domain Blogspot Menjadi Domain .com
- Custom Domain Blogspot Terbaik dan Termurah
- PKL_Visual 03 Special Replace & Fullhack ALL WINDO...
- PKL_Visual 04 Special Wallhack + Replace + SG Bren...
- PKL_Visual 01 Update 25 November 2011 5 Jam No BT ...
- PB Menu V 9,8 special menu D3D full bug T(Bug temp...
- PB V 9.6 Special Replace Weapon + 1 Hit +Full WH +...
- PB Menu WH , No SMoke , X-Hair 4 Macam + Hp Minus ...
- Cara membuat komputer anda jadi web server lokal
- Cara Membuat website Gratis
- Contoh program Animasi Stack C++
- PB hack V 8.9 Special Magneted + AIMBOT(Auto Heads...
- Membuat Animasi Queue Dalam Pemograman C++
- PB Hack V 9.0 Special Replace Weapon Trial Mode (m...
- Program Queue (antrian) C++
- Program Queue C++
- PB hack V 8.6 Special Penambahan Fitur Hot (RESET ...
- Point Blank Hack V 8.4
- Langkah-langkah membuat web service sederhana
- PB hack Special Fullhack , Wh , ammo , full Bom , ...
- PB HACK V 7.4 Special Super Hack (Semua Fitur Full...
- Sejarah Perkembangan RAM/Memory
- PB hack V 7.1 Special FullCash + Replace Weapon SG...
- CARA VERIFIKASI PAYPAL ACCOUNT MENGGUNAKAN REKENIN...
- WH Bersih Doang
- PB hack V 7.0 Revisi 6.9 , updates fullhack SG bis...
- DDL DAN DML PADA BASIS DATA
-
▼
November
(34)
0 komentar:
Posting Komentar