944,183 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1955
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 3rd, 2007
0

Problem kicking my but!!! can anybody help?

Expand 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
  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...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zebra59 is offline Offline
7 posts
since Jan 2007
Mar 3rd, 2007
0

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

p->link = q;, perhaps? It's hard to say with your little uninformative guessing game.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 3rd, 2007
0

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

sorry but that all the info that i have, however thanks for you rresponse
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zebra59 is offline Offline
7 posts
since Jan 2007
Mar 3rd, 2007
0

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

> q->link = NULL;
Your struct doesn't contain a member called link ?
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Mar 3rd, 2007
0

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

>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
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 3rd, 2007
0

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

Click to Expand / Collapse  Quote originally posted by zebra59 ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zebra59 is offline Offline
7 posts
since Jan 2007
Mar 3rd, 2007
0

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

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 3rd, 2007
0

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

Click to Expand / Collapse  Quote originally posted by Narue ...
>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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zebra59 is offline Offline
7 posts
since Jan 2007
Mar 3rd, 2007
0

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

>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?
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 3rd, 2007
0

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

Click to Expand / Collapse  Quote originally posted by Narue ...
>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.
cpp Syntax (Toggle Plain Text)
  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....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
zebra59 is offline Offline
7 posts
since Jan 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: classes function help
Next Thread in C++ Forum Timeline: Ivor Horton's Visual C++ 2010 book for learning C++





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC