structures to draw and SIMPLY explain. #1.) Add a node to the beginning of a queue. #2.) Add a…

structures to draw and SIMPLY explain.

#1.) Add a node to the beginning of a queue.

#2.) Add a node to the end of a queue

you can use paper and post me the image if you want.

QUEUE.C

//queue

#include

#include

#include

#include

struct entry

{

char name[81];

} part;

typedef struct LISTREC

{

struct entry info;

struct LISTREC * link;

} LISTREC;

LISTREC *top , *purgequeue(), *ne, *p, *last;

void push(), pop();

void printqueue();

void loadfile();

void countqueue();

void menu();

FILE *stream1,*stream2;

void savequeue();

void main()

{

char selection;

top = NULL;

stream1 = fopen(“data.bin”,”r+b”);

/* initialize */

loadfile();

clrscr();

for (;;) {

menu ();

selection = getche();

switch (toupper(selection))

{

case ‘1’ : push();clrscr() ; break;

case ‘2’ : pop(); clrscr() ; break;

case ‘3’ : printqueue(top) ; clrscr() ; break;

case ‘4’ : loadfile() ; clrscr() ; break;

case ‘5’ : savequeue() ; clrscr(); break;

case ‘6’ : countqueue() ; clrscr(); break;

case ‘7’ : top = purgequeue(top) ; clrscr(); break;

case ‘Q’ : clrscr() ; return ;break;

} /* switch */

} /* for */

} /* main */

void push()

{

clrscr();

gotoxy(10,12);

printf(“n name to add “);

scanf(” %[^n]”,part.name);

ne=(LISTREC *) malloc(sizeof(LISTREC));

ne->info=part;

ne->link=NULL;

if (! top) top=last=ne;

else { last->link=ne; last=ne; }

//ne->link=top;

//top=ne;

}//push

void printqueue(LISTREC *top)

{

clrscr() ;

printf (“nn”);

while (top){

printf(“n %s “, top->info.name);

top = top->link;

} /* while */

gotoxy(52,25) ; printf(“Press Any Key to Continue”) ; getch();

} /* printqueue */

void pop ()

{

clrscr();

gotoxy(10,12);

if (! top) { printf(“na the queue is empty !!!”); getch(); return;}

p=top;

top=top->link;

printf(“n %s”,p->info.name);

getch();

free(p);

} /* pop */

void loadfile ()

{

int n;

rewind(stream1);

for(;;) {

n=fread(&part,sizeof(part),1, stream1);

if (!n) break;

ne=(LISTREC *) malloc(sizeof(LISTREC));

ne->info=part; ne->link=NULL;

if (! top) top=last=ne;

else { last->link=ne; last=ne; }

}//for

}//loadfile

void savequeue ()

{

stream2 = fopen(“output.bin”,”w+b”);

p = top;

while (p)

{

fwrite(&p->info,sizeof(part),1,stream2);

// fprintf(stream2,”n %s”,p->info.name);

p=p->link;

}

fclose(stream2);

}

void countqueue ()

{

int i = 0;

p = top;

while (p)

{

i++;

p=p->link;

}

clrscr() ; gotoxy(27,12) ;

printf(“Total Items in queue – %d”,i);

gotoxy(52,25) ; printf(“Press Any Key to Continue”);

getch();

}

void menu ()

{

gotoxy(30,1) ; printf(“NORTHEASTERN UNIVERSITY”);

gotoxy(32,2) ; printf (“University College”);

gotoxy(37,3) ; printf (“MIS 4277”);

gotoxy(19,9) ; printf (” 1 – Add an Item to the queue “);

gotoxy(19,10) ; printf (” 2 – Delete an Item from the queue “);

gotoxy(19,11) ; printf (” 3 – List the queue from Top to Bottom “);

gotoxy(19,12) ; printf (” 4 – Load File to Current queue “);

gotoxy(19,13) ; printf (” 5 – Save Current queue in File OUTPUT.BIN “);

gotoxy(19,14) ; printf (” 6 – Count Number of Items in queue “);

gotoxy(19,15) ; printf (” 7 – Purge the Entire queue “);

gotoxy(19,16) ; printf (” Q – End the program “);

gotoxy(25,22) ; printf (“Please enter your selection – “);

}

LISTREC *purgequeue (LISTREC *top)

{

p = top;

while (p)

{

top = top->link;

free(p);

p=top;

} /* while */

clrscr() ; gotoxy(27,12) ; printf(“queue has been Purged”);

gotoxy(52,25) ; printf(“Press Any Key to Continue -“) ; getch();

return (top);

} /* purgequeue */

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!