Output your values at key points in your code to
1) make sure the variables contain the values they should
2) make sure the IF is processing the correct code
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Is there a requirement behind what you're doing? Seems like you're making this harder than it needs to be ... maybe you could provide more details on what your problem definition is?
Duki
Nearly a Posting Virtuoso
1,475 posts since Jun 2006
Reputation Points: 817
Solved Threads: 32
I don't need to study it carefully. I already know how to help. And I did but you obviously didn't like it. Too bad, because it will work great towards answering your questions.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Every time you enter a 'variable' increment a counter.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
how would you do that? I tried declaring int c = 0; and after you input an operator, c is increased, and replace for(l = l;l > 0; l--) with for(int c = 0; c > 0; c--) but that just messes up the loop and the program doesnt run properly.
Answer #1) Then think about it longer and try again.
Answer #2) And that's was supposed to tell me what you did and I'm supposed to be able to tell you how to fix your code from this description?
Answer #3) Then try something else thatwill work.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Try explaining what is wrong -- in detail.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Your code will not enter the inner for() loop because you have c = 0 right before it and your condition is when c > 0 .
sfuo
Practically a Master Poster
656 posts since Jul 2009
Reputation Points: 164
Solved Threads: 99
Try explaining what is wrong -- in detail.
You said to insert a counter when I enter a variable. I did that and it doesn't work. All I need to do is detect how many operators the user imputed.
And that's explaining the problemin detail? I think the first thing you need to understand is what detail means.
Your code will not enter the inner for() loop because you have c = 0 right before it and your condition is when c > 0 .So how would you write it?
You're kidding, aren't you?
Sit down with your instructor and tell him you are having problems understanding why the codeSTFU referenced is wrong. He's the one you need to take these little problems to. We are a help forum, not a teaching forum and you need to be taught some very very basic concepts. Your instructor is the best one to do that.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Walt why are you so hostile all the time? I could sit here all day calling people stupid because some of them have no clue what they are doing.
If you think they are retarded don't reply to the post.
sfuo
Practically a Master Poster
656 posts since Jul 2009
Reputation Points: 164
Solved Threads: 99