Hi, I need to have 3 lines and I need help with them please.
This is example of the output:
1:00:11pm: Customer ANGEL checking in line A.
1:01:36pm: Customer ANGEL checking out of line 1 waited 85 seconds.
so TIME: Customer NAME checking in line x.
Should I make 3 queue pointers like this?:
Code:
struct queue* LineA;
struct queue* LineB;
struct queue* LineC;
LineA = (struct queue*)malloc(sizeof(struct queue));
LineB = (struct queue*)malloc(sizeof(struct queue));
LineC = (struct queue*)malloc(sizeof(struct queue));
or only have one pointer and have 3 lines some other way with a function?
Because I was having trouble with how to print it. If I make a function called lines, I was thinking I could print in main something like this:
//printf("TIME: Customer %s checking in line %s\n", name, lines(QueuePtr));
and I would be using if statements in the function or in main
I haven't sorted out how to do the time yet.
like How would I get it to say checking in line A?
So if I do make a function called lines, should it have only one parameter or 3 for each of the lines?
ex.
Code:
int lines(struct queue* p)
{
for(i=0; i<=MAX_CUSTOMERS; i++);
{
if(items<=10 && p!=NULL)
p == A;
return A;
else if ...
}
};
//MAX_CUSTOMERS is 8
These are the functions I have right now:
//I have them, but I just declared them here.
void initial_queue(struct queue* p);
int enqueue(struct queue* p, int value);
int dequeue(struct queue* p);
int empty(struct queue* p);
int front(struct queue* p);
There is an input file by the way.