Airplane!

int main () {

    bool SteveMcCroskeyIsInFilm = true;
    int vicesToResume = 4;
    string vice;
   
    while (SteveMcCroskeyIsInFilm) {

        switch (vicesToResume) {
            case 4:
                vice = "smoking";
                break;
            case 3:
                vice = "drinking";
                break;
            case 2:
                vice = "amphetamines";
                break;
            case 1:
                vice = "sniffing glue";
                break;
            default:
                break;
        }

        if (impendingCatastophe) {
            if (vicesToResume > 0) {
                cout << "Looks like I picked the wrong week to quit " << vice << "\n";
                resumeVice ();
                vicesToResume--;
            } else {
                defenestrateImmediately ();
                SteveMcCroskeyIsInFilm = false;
            }
            resetCatastropheDueToTedStriker ();
        }
    }
}
Vote up this code1
  • mike donnelly

    Heheh cracked me up! Careful running this one it’s prone to crashing.

    • Jamie Zigelbaum

      Thanks! The code shouldn’t even compile — I left out the method declarations in favor of more concise humor . . . but now that I think of it making it run while keeping the humor/point snappy would have been a nice challenge. For the next one

      • Catherine

        Darling I think that comment was a pun ? quite a good one! xxx

        • Jamiezigelbaum

          Darling! <3 It IS a pun! Thank you for that. I can't believe I missed it.

          @Mike, nicely done.