Answer to Question #29933 in C++ for rishi taukoordass
2013-05-16T10:34:53-04:00
Implement a thread safe class to manage a queue of objects.Accessing the front of the queue should be a blocking operation when the queue is empty.
1
2013-05-16T10:33:55-0400
#include<iostream> #include<string> #include<queue> using namespace std; class safe:public queue<double>{ public: double front(){ if (this->empty()==1) return 0; else return this->queue::front(); } }; int main() { safe s; s.push(1); cout<<s.front()<<endl; s.pop(); cout<<s.front()<<endl; system("PAUSE"); return 0; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment