pls help me it is so urgent
ı need short examples with queues,
it is so important me pls send there small exercises that done with queue
thanks so much everyone
Printable View
pls help me it is so urgent
ı need short examples with queues,
it is so important me pls send there small exercises that done with queue
thanks so much everyone
Google?
Edit: You could have at least checked out this site, btw....
http://www.cprogramming.com/tutorial...ory/queue.html
That contains a link to a code example.
Google: "Queue exercises in C++"
pls sned ı search all interenet but cant find if u have queue examples send
Try clicking the link?
just one example and no more pls interest this topic
There you go, that's an example of a using a queue.Code:int main()
{
Queue.insert(1);
Queue.insert(2);
cout << Queue.get();
cout << Queue.get();
return 0;
}
--
Mats
Does anyone think this will do?
Code:template <typename T>
class q {
private:
class p {
public:
p() : n(0) {};
T d;
p *n;
};
p *h, *t;
public:
q<T>(): h(0), t(0) {};
void insert(T x) {
t = (t)?(t->n=new p):(h = t = new p);
t->d = x;
};
bool get(T &x) {
p* p = h; if (!p) return false;
x = p->d; h = (p == t)? t = p->n : p->n;
delete p;
return true;
};
};
On the obfuscation: I'm sure I could make get use another terniary operator for the return value, but I guess it's close enough as it is...
--
pls help me more complex examples nuone doesnt know about queue?
I've just been shopping, and there are plenty of queues at the checkouts.
There's even an "8 items or less" express checkout.
Write a simulation modelling the movement of people through a store checkout, where
- number of items
- number of distracting / yelling kids
- number of money off coupons
- method of payment (cash, cheque, card)
All affect how fast an individual person makes it through the checkout.