I haven't posted in a while, and I don't even know if I'm allowed to ask, but I need some help with debugging my simple programming stuff. If you're willing I can inbox you the code. If not just don't post because flamers aren't cool
-
Sure, I can take a look if you want. (I don't guarantee I'll be able to find your issue though)
-
Oh im sure you can I'm a month in to my 1st programming class ever.
-
nevermind bungies filters think the code is malicious so I'll just try and figure it out myself
-
Post the section where it is giving you trouble. Use debugger to see where it breaks. Put breaks down the column for every line of code :P And what error are you getting?
-
I can take a look at it...
-
[quote][b]Posted by:[/b] dfisch5 nevermind bungies filters think the code is malicious so I'll just try and figure it out myself[/quote] Copy the code into [url=http://pastie.org/]here[/url] and post the link it gives you.
-
[quote][b]Posted by:[/b] Razgriz Berkut Post the section where it is giving you trouble. Use debugger to see where it breaks. Put breaks down the column for every line of code :P And what error are you getting?[/quote]There isn't an error it runs, but some of the answers it gives are wrong
-
its just a program finding the top 2 numbers of 10 just using loops. No arrays
-
Do what pvr posted No arrays. So in guessing ur using two variables that keep track of the bigger numbers. Then u replace One if it finds another number that is larger? [Edited on 10.04.2012 8:25 PM PDT]
-
[quote][b]Posted by:[/b] HD PVR [quote][b]Posted by:[/b] dfisch5 nevermind bungies filters think the code is malicious so I'll just try and figure it out myself[/quote] Copy the code into [url=http://pastie.org/]here[/url] and post the link it gives you.[/quote][url]http://pastie.org/4912080[/url]
-
[quote][b]Posted by:[/b] Razgriz Berkut Do what pvr posted No arrays. So in guessing ur using two variables that keep track of the bigger numbers. Then u replace One if it finds another number that is larger?[/quote]exactly im just too stupid to figure it out
-
I assume you ran a for loop 10 times and then set max = 1... followed by an if(i > max) { secoundMax=Max max = i }
-
Also post an out put example and the numbers u used in order :) would help me a lot. In using my tablet. So i cant copy paste I think it would be best to do a for loop of ten iterations as mentioned before. If it requires 2 inputs per iteration then ill try a mental run :p [Edited on 10.04.2012 8:32 PM PDT]
-
I'm assuming the issue is that your second largest number is not correct?
-
[quote][b]Posted by:[/b] Razgriz Berkut Also post an out put example and the numbers u used in order :) would help me a lot. In using my tablet. So i cant copy paste[/quote]The error is if i do something like 1 3 77 6 88 6 5 4 3 2 it says the 2nd largest is 6
-
[quote][b]Posted by:[/b] CostlyAxis I'm assuming the issue is that your second largest number is not correct?[/quote]yep
-
[quote][b]Posted by:[/b] dfisch5 [quote][b]Posted by:[/b] CostlyAxis I'm assuming the issue is that your second largest number is not correct?[/quote]yep [/quote] When you set your new largest value, you need to then also update the second largest value to the previously largest number. This is because if the largest value was dwarfed, then so too was the second largest one by the previous largest value. [Edited on 10.04.2012 8:33 PM PDT]
-
Nevermind. [Edited on 10.04.2012 8:34 PM PDT]
-
[quote][b]Posted by:[/b] da mob boss12 I'm not a programmer but what is the \n doing in your "the second largest number" part?[/quote] That's a newline character. It's for formatting.
-
[quote][b]Posted by:[/b] da mob boss12 Nevermind.[/quote]that starts a new line on the quote
-
[quote][b]Posted by:[/b] CostlyAxis [quote][b]Posted by:[/b] dfisch5 [quote][b]Posted by:[/b] CostlyAxis I'm assuming the issue is that your second largest number is not correct?[/quote]yep [/quote] When you set your new largest value, you need to then also update the second largest value to the previously largest number. This is because if the largest value was dwarfed, then so too was the second largest one by the previous largest value.[/quote]How is that done?
-
[quote][b]Posted by:[/b] dfisch5 How is that done?[/quote] X Drag0n Fate X actually gave a pretty good answer on that. Where you have: [quote]largest = number;[/quote] You also need to set [i]larger[/i]: [quote]larger = largest; largest = number;[/quote]
-
[quote][b]Posted by:[/b] CostlyAxis [quote][b]Posted by:[/b] dfisch5 How is that done?[/quote] X Drag0n Fate X actually gave a pretty good answer on that. Where you have: [quote]largest = number;[/quote] You also need to set [i]larger[/i]: [quote]larger = largest; largest = number;[/quote][/quote] This. I recommend running a 10 iteration for loop if the assignment allows it. Pretty much. Whenever largest number is found, set larger to the previouse largest number before you set largest to the number. [Edited on 10.04.2012 8:42 PM PDT]
-
[quote][b]Posted by:[/b] CostlyAxis [quote][b]Posted by:[/b] dfisch5 How is that done?[/quote] X Drag0n Fate X actually gave a pretty good answer on that. Where you have: [quote]largest = number;[/quote] You also need to set [i]larger[/i]: [quote]larger = largest; largest = number;[/quote][/quote]OHHHHHHHHH thanks flood I love you
-
[quote][b]Posted by:[/b] dfisch5 How is that done?[/quote] You need to do something like this: [quote]if( number >= largest ) { [i]larger = largest;[/i] largest = number; } else if( number >= larger ) larger = number; [/quote] edit: too slow :p [Edited on 10.04.2012 8:42 PM PDT]
-
[quote][b]Posted by:[/b] Razgriz Berkut [quote][b]Posted by:[/b] CostlyAxis [quote][b]Posted by:[/b] dfisch5 How is that done?[/quote] X Drag0n Fate X actually gave a pretty good answer on that. Where you have: [quote]largest = number;[/quote] You also need to set [i]larger[/i]: [quote]larger = largest; largest = number;[/quote][/quote] This. I recommend running a 10 iteration for loop if the assignment allows it.[/quote]idk what that means haha I've only been doing this for a month