+ 1

Did I mess something up here?

I finished another part of my code and I dont understand what the output means by cannot find symbol. Did I code something wrong here? Please help, the part that's the issue is the non-commented code towards bottom https://code.sololearn.com/cXm0btZi9v6D/?ref=app

30th Dec 2018, 10:02 PM
Dustin James Locey
Dustin James Locey - avatar
16 Respostas
30th Dec 2018, 11:12 PM
CodeMStr
CodeMStr - avatar
+ 2
This is the code how I want to run it, with everything there
30th Dec 2018, 10:45 PM
Dustin James Locey
Dustin James Locey - avatar
+ 2
It just shows as 0.0 in the output text
30th Dec 2018, 11:42 PM
Dustin James Locey
Dustin James Locey - avatar
+ 2
Ohh, I see it now, I got it working then. Thank you so much for the help
30th Dec 2018, 11:56 PM
Dustin James Locey
Dustin James Locey - avatar
+ 2
Thanks, I'm making it for work to make figuring orders easy lol. I'm very new to coding though, just using the basics I've learned so far, which isnt much lol
31st Dec 2018, 12:00 AM
Dustin James Locey
Dustin James Locey - avatar
+ 1
My inputs are: bi-folder 2 4 no 4 70 24
30th Dec 2018, 10:17 PM
Dustin James Locey
Dustin James Locey - avatar
+ 1
I just fixed it so you can run it with my inputs to see the output. I dont understand because it says the error is on line 77. Which is in comments..
30th Dec 2018, 10:33 PM
Dustin James Locey
Dustin James Locey - avatar
+ 1
If you run it with the input how I put it. It gives errors. Please help https://code.sololearn.com/cK4w2x02nqzV/?ref=app
30th Dec 2018, 10:45 PM
Dustin James Locey
Dustin James Locey - avatar
+ 1
This is with nothing commented
30th Dec 2018, 10:46 PM
Dustin James Locey
Dustin James Locey - avatar
+ 1
It works, what did you change if I may ask? The only issue is on line 147. It didnt assign 'double lastpnlfc' to the value of 'lastpanelwidth + foam + 0.5
30th Dec 2018, 11:35 PM
Dustin James Locey
Dustin James Locey - avatar
+ 1
Ohhh, okay, how come it is showing up as 0.0 though if I have it changing the variable?
30th Dec 2018, 11:44 PM
Dustin James Locey
Dustin James Locey - avatar
0
I think the problem was that you were calling a local variable outside its local environment, this returns the 'symbol not found' error which basicly means you tried to use a variable that wasn't declared. I haven't read the whole code so I might be wrong
30th Dec 2018, 10:43 PM
CodeMStr
CodeMStr - avatar
0
Declare every variable right after main() or declare them with the inputs. You also have to get rid of most of the 'double' declarations, since they are already declared
30th Dec 2018, 10:56 PM
CodeMStr
CodeMStr - avatar
0
double lastpnlfc = 0; double lastpnlbk = 0; double samevinylsizes = 0; double firstpanelvelcro = 0; These are variables defined before their usage if(panels == 1) { samevinylsizes = 0; } else if(panels == 3) { samevinylsizes = 4; } else if(panels == 5) { samevinylsizes = 8; } else if(panels == 7) { samevinylsizes = 12; } Notice how there aren't any double declarations, this is because we defined them before and thus don't need another declaration You defined a diffrent variable every time you checked the if's, these are local variables and don't work outside their curly brackets
30th Dec 2018, 11:42 PM
CodeMStr
CodeMStr - avatar
0
Lastpnlfc is autodefined as 0. This changes on line 141, but this line is never run because lastpnlwidth equals 24. So lastpnlfc stays 0 has it to be 26.5?
30th Dec 2018, 11:49 PM
CodeMStr
CodeMStr - avatar
0
Good luck with your code
30th Dec 2018, 11:59 PM
CodeMStr
CodeMStr - avatar