ok, when you get an "if" to loopback to the main by putting in main(); , how can I get it to loopback to a different "if" instead of the original main() at the top?
ok, when you get an "if" to loopback to the main by putting in main(); , how can I get it to loopback to a different "if" instead of the original main() at the top?
Can you be more specific and may be even post the source code you are having problems with?
1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!
Use the goto(); command?
i'm not stupid, just a little short on brains.
Kav's game!
Featuring:
# - Goodguy mc goodguy
* - Bad guy mc badguy
$ - Princess Mc Cess
@ - Mcdonalds Mc chicken! mmmmmm
You shouldn't make explicit calls to main(). You can use exception handling for breaking code blocks, however it really depends on the actual problem.
Dunno if this is acceptable programming style, but it works for me. Why not use function calls as part of your ifs?
#include <iostream.h>
int someFunction1(int &);
void someFunction2(int &);
int main()
{
int signal = -1;
int whatDrive;
cout << "Starting execution." << endl;
for(;
{
whatDrive = someFunction1(signal);
if(whatDrive == 0)
someFunction2(whatDrive);
else if(whatDrive == 1)
cout << "do this" << endl;
else
{
cout << "do nothing" << endl;
break;
}
signal ++;
}
cout << endl << "Returned from two function calls ok.";
return 0;
}
int someFunction1(int &counter)
{
int tryMe;
tryMe = counter + 1;
return tryMe;
}
void someFunction2(int &stuff)
{
cout << "the drive is: " << stuff << endl;
}