cirular arrys queue has me running in circles

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 20
Reputation: phillipeharris is an unknown quantity at this point 
Solved Threads: 0
phillipeharris phillipeharris is offline Offline
Newbie Poster

cirular arrys queue has me running in circles

 
0
  #1
Aug 19th, 2008
Well I dont know where I am going wrong.... I and trying to do this queue with out the STL I am having issues with my enqueue () How do I get the contritor Info into the enqueue.

I am trying to do it as simle as possible and I seem to not be able to get around this one thing. Any help would be nice .
Attached Files
File Type: cpp myQueue.cpp (2.3 KB, 10 views)
File Type: h myQueue.h (495 Bytes, 6 views)
File Type: cpp Contributor.cpp (3.5 KB, 6 views)
File Type: h Contributor.h (1.8 KB, 5 views)
File Type: cpp lab3.cpp (11.1 KB, 7 views)
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: cirular arrys queue haas my running in cirlcels

 
0
  #2
Aug 19th, 2008
If you want to enqueue Contributors, why do you use an int array? And why the () in the parameter of enqueue()? Do you want to enqueue Contributor objects or pointers to Contributor objects?
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: cirular arrys queue haas my running in cirlcels

 
0
  #3
Aug 19th, 2008
And a style hint:

  1. if (Index == size){return true;}
  2. else{return false;}

is the same as

  1. return Index == size;
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 226
Reputation: henpecked1 is an unknown quantity at this point 
Solved Threads: 1
henpecked1 henpecked1 is offline Offline
Posting Whiz in Training

Re: cirular arrys queue has me running in circles

 
0
  #4
Aug 19th, 2008
How would you do either or both (enqueue contributor objects or pointers to the contributor objects) I guess would be my question. As a beginner as well, I'm not sure how you would pass either into the function.

I copied the code and started changing how it's done and no matter how I do it, I get errors. Some that say not an overloaded function, some that say cannot convert from int, and some that say something about referencing a non constant object

I would also ask (dunno if Phil wants to know this also) how would this be implemented in main?
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 226
Reputation: henpecked1 is an unknown quantity at this point 
Solved Threads: 1
henpecked1 henpecked1 is offline Offline
Posting Whiz in Training

Re: cirular arrys queue has me running in circles

 
0
  #5
Aug 19th, 2008
Also, how do you declare the array if you want it to be an array of Contributors?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 20
Reputation: phillipeharris is an unknown quantity at this point 
Solved Threads: 0
phillipeharris phillipeharris is offline Offline
Newbie Poster

Re: cirular arrys queue has me running in circles

 
0
  #6
Aug 21st, 2008
wellI rewrote the MyQueue.h and cpp but I cant get it to work.
1. myQueue &operator = (myQueue & RHS);
2 . I dont know if my enqueue() is correct.

gerry .. if you found a way .. let me know
Attached Files
File Type: cpp Contributor.cpp (3.5 KB, 5 views)
File Type: h Contributor.h (1.8 KB, 4 views)
File Type: cpp lab.cpp (1.6 KB, 7 views)
File Type: cpp myQueue.cpp (2.5 KB, 7 views)
File Type: h myQueue.h (625 Bytes, 6 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 2
Reputation: JerryCTU is an unknown quantity at this point 
Solved Threads: 0
JerryCTU JerryCTU is offline Offline
Newbie Poster

Re: cirular arrys queue has me running in circles

 
0
  #7
Aug 21st, 2008
Phil, I'll have another look in the AM, I got on kinda late

I was still working on your last version, and I might have a clue now...lol.
Last edited by JerryCTU; Aug 21st, 2008 at 2:30 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 2
Reputation: JerryCTU is an unknown quantity at this point 
Solved Threads: 0
JerryCTU JerryCTU is offline Offline
Newbie Poster

Re: cirular arrys queue has me running in circles

 
0
  #8
Aug 21st, 2008
Are we missing a "const" before the myQueue within the parentheses?

Also, do we need to pass all that info individually in the enqueue function? I don't think so. We should be able to pass it just like we did with the linked list, by using (Contributor In) or something like that.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 226
Reputation: henpecked1 is an unknown quantity at this point 
Solved Threads: 1
henpecked1 henpecked1 is offline Offline
Posting Whiz in Training

Re: cirular arrys queue has me running in circles

 
0
  #9
Aug 22nd, 2008
got the overloaded = function fixed, but still not sure how to pass the contributor object into the enqueue function
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: cirular arrys queue has me running in circles

 
0
  #10
Aug 22nd, 2008
  1. bool enqueue(Contributor const & contributor);

or

  1. bool enqueue(Contributor const * contributor);

or something like that. I don't know, if you want to pass contributor by refenrence o by pointer.
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC