Thread
:
State Machines
View Single Post
Reply
Posted 2002-06-15, 09:34 AM in reply to
WetWired
's post
"State Machines"
Okay, I know what you're talking about now...
switch (melmac)
{
case 0: {run code here; melmac = 1; break;}
case 1: {run code here; do calculations; if (bob == 5) melmac = 2; else melmac = 3; break;}
case 2: {cout << "Bob equaled five!"; break;}
case 3: {cout << "Stupid Bob, it didn't equal five!"; break;}
}
Will only run one case statement each time through (might be a bit off, haven't programmed in C++ in a few months...)
Profile
PM
WWW
Search
BlueCube