Author |
Message |
luckycrime
Joined: Wed Mar 09, 2011 2:49 pm Posts: 457
Gender: Male
Currently Playing: Ball Breaker with your sister. it's a real game...
|
I decided to make a small simple game where you do math..... After I got it to work I decided to have a little fun for the rare ocassion that someone would type in a value over 100. I used void functions since they're suppose to be easiest to work with. All I want to do is make the tiny piece on the bottom work which is a which statement. Can someone explain what I'm doing wrong?
_________________ As cold and empty as space. This is who I am.
|
Tue Apr 10, 2012 3:35 pm |
|
|
Tid
Joined: Fri Jan 02, 2009 6:02 pm Posts: 7283 Location: Australia Country:
Gender: Male
MGN Username: Tid
Currently Playing: Deep™ The™ Game™
|
the while conditional at the start of that last segment does not have a corresponding do statement i'd explain how they're supposed to work but you have a correctly set up one in the section above it
_________________Ask me anything!!! Special thanks to Steven for my beautiful Deep avatar! <3
|
Tue Apr 10, 2012 8:44 pm |
|
|
SS
Joined: Sat Aug 16, 2008 8:38 am Posts: 6670 Location: Darkest Antartica Country:
Gender: Male
Skype: Thaiberium
Currently Playing: The Game
|
|
Wed Apr 11, 2012 4:50 am |
|
|
Tid
Joined: Fri Jan 02, 2009 6:02 pm Posts: 7283 Location: Australia Country:
Gender: Male
MGN Username: Tid
Currently Playing: Deep™ The™ Game™
|
oh, after running the code through my compiler i get what you're saying now. I was under the impression you were getting actual build errors, and i was looking for an issue with your syntax.
the issue is that it can't leave that first do while loop until *Zega == 25 see, to fulfill that second while conditional, it's gotta be greater than 100, but it can't get to that second while conditional until it leaves your first loop (and like i said, it can't do that till *Zega == 25, which is most definitely not > 100). The issue is not with your code, or else you'd be getting a build error. It's just logically impossible for the program to reach the while conditional and still have *Zega > 100. Just put the >100 stuff in another else if.
_________________Ask me anything!!! Special thanks to Steven for my beautiful Deep avatar! <3
|
Wed Apr 11, 2012 5:02 am |
|
|
luckycrime
Joined: Wed Mar 09, 2011 2:49 pm Posts: 457
Gender: Male
Currently Playing: Ball Breaker with your sister. it's a real game...
|
It's still not working. I think I may have missed something about loops. I put the while statement stuff in with a else if and even if I type a value over 100 it still reads "very close" Thanks for the help I'm greatful. I need to learn what I missed about do while loops because it isn't working the way I want.
_________________ As cold and empty as space. This is who I am.
|
Wed Apr 11, 2012 2:47 pm |
|
|
Tid
Joined: Fri Jan 02, 2009 6:02 pm Posts: 7283 Location: Australia Country:
Gender: Male
MGN Username: Tid
Currently Playing: Deep™ The™ Game™
|
it's probably not ever going to the else if (*Zega > 100) because it's doing the else if (*Zega > 25) first, you need to chuck an && *Zega < 100 in there. But jesus, your indentation and whitespace formatting is so bad, there's honestly probably some nesting issue or typo somewhere in there. Lets restructure a bit, shall we? We use tabs, not space bars, to indent a line forward. We'll give close braces their own line so that we can clearly see how far they're indented and what open braces they correspond to. While we're at it, we'll throw in that logical AND change I mentioned. Running this through my compiler, I had no issues getting it to access any of your else if selections.
_________________Ask me anything!!! Special thanks to Steven for my beautiful Deep avatar! <3
|
Wed Apr 11, 2012 3:59 pm |
|
|
luckycrime
Joined: Wed Mar 09, 2011 2:49 pm Posts: 457
Gender: Male
Currently Playing: Ball Breaker with your sister. it's a real game...
|
YES! It works well almost..... There something wrong with my switch case but I can handle it.....hopefully. I've trouble you enough I must make this one work by myself. Thanks again
_________________ As cold and empty as space. This is who I am.
|
Wed Apr 11, 2012 5:02 pm |
|
|
Tid
Joined: Fri Jan 02, 2009 6:02 pm Posts: 7283 Location: Australia Country:
Gender: Male
MGN Username: Tid
Currently Playing: Deep™ The™ Game™
|
No problem, happy to help where I can. I noticed your Switch case was a bit broken, but you were using functions that aren't a part of this file, so I didn't look too far into it.
_________________Ask me anything!!! Special thanks to Steven for my beautiful Deep avatar! <3
|
Wed Apr 11, 2012 6:43 pm |
|
|