+ 1
How to input strings in a queue?
Let’s say that when running the code, the user decides to enter “Josh” who becomes the first person to enter the cash register line. Then, the user enters “Casie” and so on. Would the ideal form of declaring be char qput(), string qput() or something else?
2 odpowiedzi
+ 6
If you are implementing queue using an array then simply take an array of strings.
string data[20];
and if you are using a linked list then just modify the linked list node structure as
struct node{
string data;
node* next;
};
+ 2
I'd use string as it provides some protection from bugs. While knowledge of pointers is important, they should be avoided when ever possible.