Error trapping without loops
Author |
Message |
evogre3n
|
Posted: Sun Oct 30, 2005 12:15 pm Post subject: Error trapping without loops |
|
|
Hey all,
I have a simple if structure assignment to prove I know how to use it properly etc.
THe problem is im not allowed to use any kind of loop for error trapping.
And if I have 4 inputs lets say..
Input 1 --> correct
Input 2 --> correct
Input 3 --> WRONG try again
Input 4 --> null
If i enter the wrong input at the 3rd input, I dont want it to go back to the very first input and ask it again (so calling the method in the if structure is out of the question)
Any help on this?
Thanks a lot! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Sun Oct 30, 2005 12:29 pm Post subject: (No subject) |
|
|
Recursion with two methods?
code: | [Step 1]
|
|
|
|
|
V
[Step 2]<--+
| |
| wrong
V |
[Input ]---+
|
|
V
[ Done ] |
|
|
|
|
|
|
MysticVegeta
|
Posted: Mon Oct 31, 2005 6:39 pm Post subject: (No subject) |
|
|
yeah recursion is the way to go, call a void inside that void, (they call a procedure a void in java, dont they?) C++ is better i think just call the void like instead of having to go public static void and then going System.out.println("x") lol
anyways, yeah recursion, if you dont know ask miss dyke. |
|
|
|
|
|
evogre3n
|
Posted: Tue Nov 01, 2005 8:14 pm Post subject: (No subject) |
|
|
ya i figured it out guys, thanks anyways |
|
|
|
|
|
beard0
|
Posted: Wed Nov 02, 2005 3:24 pm Post subject: (No subject) |
|
|
MysticVegeta wrote: they call a procedure a void in java, dont they?
No the name for procedures/functions in java is method. A method is declared useing the type (i.e. int, float...) of its result. So a procdure (a function which doesn't return anything) returns the special type void, and so you declare the java equivalent of a procedure using the keyword void, which is a data type, and not the method itself. |
|
|
|
|
|
MysticVegeta
|
Posted: Thu Nov 03, 2005 7:39 pm Post subject: (No subject) |
|
|
Is it called a method in C++ too? I usually use the functions, rarely encounter the void methods |
|
|
|
|
|
wtd
|
Posted: Thu Nov 03, 2005 8:39 pm Post subject: (No subject) |
|
|
C++ has "functions", not "methods". |
|
|
|
|
|
|
|