I gang

Dynamic Queues

ATTENTIONS: **********MUST USE MY CODES ATTACHED IN FILES**************

struct Donut {

string flavor = "";

float price = 0.0;

Donut(string flvr, float prc) {

flavor = flvr;

price = prc;

}

Donut(){}

};

struct DonutTray {

Donut** donuts;

int capacity, front = 0, back = 0, count = 0;

DonutTray(int size) {

capacity = size;

donuts = new Donut*[capacity];

}

};

void displayDonut(Donut* donut) - displays the favor and price of the donut structure referenced by the donut pointer

void displayDonutTray(DonutTray* tray) - iterates over the array of donut references in the structure referenced by tray pointer, and uses displayDonut() to display each of the donuts referenced by the pointers in the tray array

void enqueueDonut(DonutTray* tray, Donut* donut) - enqueues the donut structure referenced by the donut pointer into the donuts array in the tray structure at the back index. Increments the count and back index making sure the back index does not go beyond the tray’s capacity

Donut* dequeueDonut(DonutTray* tray) - dequeues the donut structure at the front index from the donuts array in the tray structure. Decrements the count and increments front index making sure the front index does not go beyond the tray’s capacity. Returns the dequeued donut

Sample Output

[0] Donut: Chocolate $[url removed, login to view]

[1] Donut: Boston Crm $[url removed, login to view]

[2] Donut: Jelly $[url removed, login to view]

[3] Donut: Glazed $[url removed, login to view]

Donut: Chocolate $[url removed, login to view]

[1] Donut: Boston Crm $[url removed, login to view]

[2] Donut: Jelly $[url removed, login to view]

[3] Donut: Glazed $[url removed, login to view]

[1] Donut: Boston Crm $[url removed, login to view]

[2] Donut: Jelly $[url removed, login to view]

[3] Donut: Glazed $[url removed, login to view]

[4] Donut: Eclair $[url removed, login to view]

[0] Donut: Snowy $[url removed, login to view]

Donut: Boston Crm $[url removed, login to view]

Donut: Jelly $[url removed, login to view]

[3] Donut: Glazed $[url removed, login to view]

[4] Donut: Eclair $[url removed, login to view]

[0] Donut: Snowy $[url removed, login to view]

[1] Donut: Moonraker $[url removed, login to view]

Færdigheder: C++ Programmering

Se mere: struct programming, string cplusplus, pointers programming, pointer programming, int size, float programming, programming pointers, programming pointer, cplusplus struct, cplusplus string, cplusplus array, donuts, string float, queues, dynamic price, prc, crm dynamic, programming queues, queues programming, dynamic display banners, dynamic display banner, struct, crm programming, dynamic display websites, dynamic display photos php

Om arbejdsgiveren:
( 22 bedømmelser ) Cambridge, United States

Projekt-ID: #6003607

Tildelt til:

guvi2105

A proposal has not yet been provided

$10 USD på 1 dag
(2 bedømmelser)
2.8

3 freelancere byder i gennemsnit $13 for dette job

vano101

Hello. I am C/C++ expert and I would be able to do it in short time. Thanks...............................

$15 USD på 1 dag
(281 bedømmelser)
6.2
Imranceo

Hello !I am highly Expert in this field. I'll provide you satisfaction.So your time and money will be safe when you will award me project thanks. let's discuss more

$30 USD på 1 dag
(28 bedømmelser)
4.7
alyosama

A proposal has not yet been provided

$14 USD på 1 dag
(4 bedømmelser)
2.4