freelanceprogrammers.org Forum Index » C
(no subject)
Joined: 20 Jul 2003
Posts: 6
(no subject)
Hi,
I`m using MS Visual C++ 6.0, and I need help with the program I`m writing. I
written the whole thing, but it doesn`t really work right, so I need someone
to help me check my logic and algorithm. The question Question.pdf), the
given header and source files (ffs3 (given).h and ffs3 (given).cpp), the
input file (ffs3.txt), and the header file and source files (ffs3.h and
foodstall_C.cpp) I wrote are in the zip file attached.
What I`m basically trying to do is simulate a foodstall with 6 counters and
a queue, which can hold at most 20 people (including the people at the
counters). The people in the queue will move to the counter that has
finished serving the previous customer first, provided the counter operator
has not exceeded his operator efficiency (the number of items he can check
out in a minute).
What I tried to do, after reading in the customer information from the input
file, was create another FFCus class called counter_queue, which holds the
information of the customers at the each counter. I then use a for loop to
process every customer`s (at the counter) orders, serving the least fresh
cooked food first. If all of that customer`s orders has been served, I then
move the first customer still lining up in queue (i.e. queue[0], given FFCus
class by question) into that free counter.
This process goes on minute after minute, till the end of file, where the
last minute is Minute 26 is reached, and the program ends.
I was able to output from minute 0 to 26, showing the correct customers at
the counters and in the queue. However, there`s something wrong with the
total number of customers from minute 5 onwards. After minute 26, the
program goes into an endless loop.
I am also supposed to stop all serving once the last minute in the input
file is read, i.e. the stall closes at minute 26 and customer U is displayed
but not served. Output should go on till minute 26. How do I do that?
I`ve added some cout statements to help me find out what was wrong with the
program, and I`m sorry if that causes some sort of distraction for you.
Please help me find out what`s wrong with my program. Any help or
suggestions are greatly ppreciated!
Thank you.
Regards,
Rayne
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







