Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
4Activity
0 of .
Results for:
No results containing your search query
P. 1
Useful C Programs

Useful C Programs

Ratings: (0)|Views: 277|Likes:
Published by rsgk
Useful C programs like sorting, linked list etc...
Useful C programs like sorting, linked list etc...

More info:

Published by: rsgk on Oct 08, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

01/28/2015

pdf

text

original

 
Implementation of Queue using Array
Program:#include<stdio.h>#include<conio.h>#define null 0void main(){int a;void insert();void deletion();void disp();clrscr(); printf("\n\t Implementation of Queue using Array\n");do{ printf("\n 1.Insertion"); printf("\n 2.Deletion"); printf("\n 3.Display"); printf("\n 4.Exit"); printf("\n Enter your choice: ");scanf("%d",&a);switch(a){case 1:insert(); break;case 2:deletion(); break;case 3:disp(); break;case 4:exit(0); break;default: printf("\n Invalid choice........Try again"); break;}}
 
while(a<4);getch();}int q[10],n=5,f=0,r=0;void insert(){int b;if(r>=n){ printf("\n Queue Overflow.........");return;}else{ printf("\n Enter the element: ");scanf("%d",&b);q[r]=b;r++; printf("\n The inserted element is %d",b);f=1;return;}}void deletion(){int b;if(f==0){ printf("\n Queue Underflow....");return;}else{ b=q[f]; printf("\n The deleted element is %d",b);f++;r--;return;}}void disp(){int i;if(r==0)
 
{ printf("\n Queue is empty.....");return;}else{for(i=0;i<r;i++) printf("\n The elements present in the queue are........%d",q[i]);}}Output:Implementation of Queue using Array1.Insertion2.Deletion3.Display4.ExitEnter your choice: 1Enter the element: 55The inserted element is 551.Insertion2.Deletion3.Display4.ExitEnter your choice: 1Enter the element: 66The inserted element is 661.Insertion2.Deletion3.Display4.ExitEnter your choice: 3The elements present in the queue are........55The elements present in the queue are........661.Insertion2.Deletion3.Display4.ExitEnter your choice: 2The deleted element is 661.Insertion

Activity (4)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Suresh Kumar Isk added this note
Excellent Sir, and i am computer teacher in govt school near rajapalayam. i read all materials for +2 students. all are good. i need one mark question that you posted, without answer(PDF format)
keshav315 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->