/* Real life example of the dangers of Goto statements */
int main (){
While(currentTime() >= toTime("8:00 AM")) &&
(currentTime() <= toTime("5:00 PM")){
doWork(calendarTask(currentTime()));
if(currentTime()==getLunchTime()){
goto Lunch;
}
}
While (currentTime() <= toTime("5:00 PM"){
doWork(calendarTask(currentTime()));
}
goHome(true);
Lunch:
While (currentTime() <= toTime("5:00 PM"){
//doWork(calendarTask(currentTime()));
}
goHome(false);
}
void goHome(bool productiveDay){
if(productiveDay){
exit(0);//Great Day!!!
} else{
exit(1);//Working from home tonight.
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment