Is anyone familiar with functions in pseudo codes or C - - ? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Is anyone familiar with functions in pseudo codes or C - - ?

math01math01 Posts: 10Member
I have recently started programming in C - - using the BACI compiler. I have come across a program which is giving me a hard time with the functions.

1. A caterer provides cakes and muffins to a number of bakeries 2. When an order for cakes is received this order may be despatced with a similar order for cakes from another bakery 3. Similarly when an order for muffins is received this order may be despatced with a similar order for muffins from another bakery 4. If a batch (cakes or muffins) is being made, an order for the other food must wait 5. There are three odd-numbered bakeries who order bakes: c(1), c(3), c(5) 6. There are four even-numbered bakeries who order muffins m(2), m(4), m(6), m(8)
7. Food orders arrive in random order at the caterer: c(1), m(4), m(2), c(3) etc 8. An order is added to the food batch if it does not exceed the food batch size.
Maximum batch for cakes = 3
Maximum batch for muffins = 4
9. If there is a mixed set of orders,cakes and muffins, priority is given to cakes 10. A waiting order has the same priority as other orders of the same food type. 11. Selection of a waiting order from a bakery is on a random basis.

My code so far

int cakes_in = 0;
int cakes_out = 0;
int muffins_in = 0;
int muffins_out =0;

const int Max_Numb_Cakes = 3;
const int Max_Numb_Muffins = 4;

semaphore mutex;
semaphore cakes;
semaphore muffins;

int order_and_make_cakes()


int order_make_muffins()


int change_order_status()


cobegin {cout << "orders are complete" << endl; }

I would very much like to write the functions to make the program run.If you have time please provide any input you might have. I am not an experienced programmer so if you could provide any comment with the functions i would greatly appreciate it.Thank you.
Sign In or Register to comment.