Problem kicking my but!!! can anybody help?

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2007
Posts: 7
Reputation: zebra59 is an unknown quantity at this point 
Solved Threads: 0
zebra59 zebra59 is offline Offline
Newbie Poster

Problem kicking my but!!! can anybody help?

 
0
  #1
Mar 3rd, 2007
I have this problem that I can't figure out, I can't figure out the line
statement that needs to go in.
Here's the problem
  1. struct NodeType
  2. {
  3. int data;
  4. NodeType* p;
  5. };
  6.  
  7. NodeType* p;
  8. NodeType* q;
  9.  
  10. p = new NodeType;
  11. p->data = 18;
  12. q = new NodeType;
  13. q->data = 32;
  14. <-- statement missing here
  15. q->link = NULL;
I've look @ ever example and went over the chapter on linked structures / linked list, however I just can't figure it out!!! Help
thanks for your time.
Last edited by WaltP; Mar 4th, 2007 at 2:06 pm. Reason: CODE tags mussing, too...
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,725
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 736
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Problem kicking my but!!! can anybody help?

 
0
  #2
Mar 3rd, 2007
p->link = q;, perhaps? It's hard to say with your little uninformative guessing game.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 7
Reputation: zebra59 is an unknown quantity at this point 
Solved Threads: 0
zebra59 zebra59 is offline Offline
Newbie Poster

Re: Problem kicking my but!!! can anybody help?

 
0
  #3
Mar 3rd, 2007
sorry but that all the info that i have, however thanks for you rresponse
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Problem kicking my but!!! can anybody help?

 
0
  #4
Mar 3rd, 2007
> q->link = NULL;
Your struct doesn't contain a member called link ?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,725
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 736
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Problem kicking my but!!! can anybody help?

 
0
  #5
Mar 3rd, 2007
>sorry but that all the info that i have
No wonder you can't figure it out, you don't even know what the problem is!

>Your struct doesn't contain a member called link ?
Yea, I saw that too...no, really. :o
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 7
Reputation: zebra59 is an unknown quantity at this point 
Solved Threads: 0
zebra59 zebra59 is offline Offline
Newbie Poster

Re: Problem kicking my but!!! can anybody help?

 
0
  #6
Mar 3rd, 2007
Originally Posted by zebra59 View Post
I have this problem that I can't figure out, I can't figure out the line
statement that needs to go in.
Here's the problem

struct NodeType
{
int data;
NodeType* link;
};

NodeType* p;
NodeType* q;

p = new NodeType;
p->data = 18;
q = new NodeType;
q->data = 32;
<-- statement missing here
q->link = NULL;

I've look @ ever example and went over the chapter on linked structures / linked list, however I just can't figure it out!!! Help
thanks for your time.
I fix the link part any responses
Last edited by Narue; Mar 3rd, 2007 at 6:44 pm. Reason: Closed the quote tag
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,725
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 736
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Problem kicking my but!!! can anybody help?

 
0
  #7
Mar 3rd, 2007
>I fix the link part any responses
Um, good for you? You still haven't specified enough of a problem to be solvable. You tell us what the code is supposed to be doing, and we'll tell you why it isn't working. Until then, get used to not having any useful responses.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 7
Reputation: zebra59 is an unknown quantity at this point 
Solved Threads: 0
zebra59 zebra59 is offline Offline
Newbie Poster

Re: Problem kicking my but!!! can anybody help?

 
0
  #8
Mar 3rd, 2007
Originally Posted by Narue View Post
>I fix the link part any responses
Um, good for you? You still haven't specified enough of a problem to be solvable. You tell us what the code is supposed to be doing, and we'll tell you why it isn't working. Until then, get used to not having any useful responses.

If I knew then I wouldn't be asking for your help, now would I ?
Buit thanks for looking anyway
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,725
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 736
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Problem kicking my but!!! can anybody help?

 
0
  #9
Mar 3rd, 2007
>If I knew then I wouldn't be asking for your help, now would I ?
There's a significant difference between knowing the problem and knowing the cause of the problem. Not the least of which being that I'm talking about the former and you're talking about the latter. Do you go to a doctor and just tell him to heal you? Do you go to a mechanic and tell him to fix any problems he finds? No, you go to a doctor when you're injured or ill, and can tell him where it hurts. You go to a mechanic when your car makes a funny noise that you can describe to the mechanic.

I'm the doctor, tell me where it hurts. I'm the mechanic, describe the noise you're hearing. Then I'll use my expertise to help you correct the problem. Now, what part of that are you having trouble understanding?
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 7
Reputation: zebra59 is an unknown quantity at this point 
Solved Threads: 0
zebra59 zebra59 is offline Offline
Newbie Poster

Re: Problem kicking my but!!! can anybody help?

 
0
  #10
Mar 3rd, 2007
Originally Posted by Narue View Post
>If I knew then I wouldn't be asking for your help, now would I ?
There's a significant difference between knowing the problem and knowing the cause of the problem. Not the least of which being that I'm talking about the former and you're talking about the latter. Do you go to a doctor and just tell him to heal you? Do you go to a mechanic and tell him to fix any problems he finds? No, you go to a doctor when you're injured or ill, and can tell him where it hurts. You go to a mechanic when your car makes a funny noise that you can describe to the mechanic.

I'm the doctor, tell me where it hurts. I'm the mechanic, describe the noise you're hearing. Then I'll use my expertise to help you correct the problem. Now, what part of that are you having trouble understanding?
again, like I said before, I needed to fill in the missing statement, however, I couldn't figure it out.

here is the question that was given to me.
  1. struct NodeType
  2. {
  3. int data;
  4. NodeType* link;
  5. };
  6. NodeType* p;
  7. NodeType* q;
  8.  
  9. p = new NodeType;
  10. p -> data = 18;
  11. q = new NodeType;
  12. q -> data = 32;
  13. [B]fill in this line of the missing statement.[/B]
  14. q-> link = NULL;
that was my question, I didn't know if they are looking for. Thats why I purposed the question, maybe just maybe one of the experts out there could help me out.

Thanks for you r time anyway.

Have a good day!
Last edited by WaltP; Mar 4th, 2007 at 2:09 pm. Reason: CODE tags again....
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
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