| cppnoob99 (4) | |||
Well actually output problem. It compiles and links fine, but output is definitely not where it needs to be. Can someone with a "fresh set of eyes" see if you can help. Basically it's supposed to analyze the expression entered(originalExpression) and make 2 arrays, one with positions of (, the other with positions of ). But the output from cout at the end is wayy screwey. Using VS2012:
| |||
|
|
|||
| TheIdeasMan (1753) | |
|
When you have runtime problems, by far the easiest way is use the debugger. If you have an IDE it should be easy. Create a watch list of variables, create a breakpoint, step through the code 1 line at a time, see how the values change to deduce where it all goes wrong. Having said that I can see a couple of possible problems, but it will be good practice for you to use the debugger. Using the debugger is what happens in industry, coders don't ask their co-workers for help, or go on-line for help. It's all part of learning to be a reasonably self contained coder. HTH | |
|
|
|
| cire (2347) | |
Line 20, you should be using i<lengthGet rid of line 29. i is already being incremented once per loop. | |
|
|
|
| vin (170) | |||
| |||
|
|
|||
| cppnoob99 (4) | |
|
@vin & cire ye that i was the issue can't believe I missed it, I don't even know why I put it there in a first place :/ thanks for your help @TheIdeasMan Thanks for the advice. I usually try to figure it out myself, but after staring at it for an hour, it wasn't making sense why it wasn't working. I'm still not really used to the debugger, but I did use it on this today and it works beautifully, I didn't realize how easy it was. What was great was that I could step through each statement and monitor the result. I'm still learning lol | |
|
Last edited on
|
|