From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_50,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c949,38eaf2ac280788bb X-Google-Attributes: gid10c949,public X-Google-Thread: 109fba,38eaf2ac280788bb X-Google-Attributes: gid109fba,public X-Google-Thread: f6290,38eaf2ac280788bb X-Google-Attributes: gidf6290,public X-Google-Thread: 10d15b,38eaf2ac280788bb X-Google-Attributes: gid10d15b,public X-Google-Thread: 103376,38eaf2ac280788bb X-Google-Attributes: gid103376,public X-Google-Thread: 114917,38eaf2ac280788bb X-Google-Attributes: gid114917,public X-Google-Thread: fdb77,38eaf2ac280788bb X-Google-Attributes: gidfdb77,public X-Google-Thread: 1014db,38eaf2ac280788bb X-Google-Attributes: gid1014db,public From: haverber@visi.comDELETE_CAPS_TO_RESPOND (Bill Haverberg) Subject: Re: 'Money wanted' algorithm (Cobol version) Date: 1996/12/30 Message-ID: <32c80aab.2893217@news.visi.com>#1/1 X-Deja-AN: 206802747 references: <5a8h44$elt@news.inetdirect.net> <32c8f428.76407842@news.dwx.com> organization: (missing) newsgroups: comp.lang.ada,comp.lang.asm.x86,comp.lang.basic.misc,comp.lang.c,comp.lang.c++,comp.lang.clipper,comp.lang.cobol,comp.lang.java.advocacy,comp.lang.java.api,comp.lang.java.misc,comp.lang.java.programmer,comp.lang.javascript,comp.lang.pascal.borland,comp.lang.pascal.delphi.components.misc,comp.lang.pascal.delphi.databases,comp.lang.pascal.delphi.misc,comp.lang.perl.misc,comp.lang.smalltalk,comp.lang.tcl,comp.mail.eudora.ms-windows,comp.mail.sendmail,comp.multimedia,comp.music.midi,comp.object,com Date: 1996-12-30T00:00:00+00:00 List-Id: renegade@dwx.com (Renegade) wrote: >congee@mindspring.com (Deric Cheng) wrote: >>dennis@qltel.exonet.nl (Dennis Janssen) wrote: >> >>>Hi Deric, >> >>>**>> I need alot of money badly; Could anyone help? >> >>>DC> Step 1 Find empty coffee cup >>>DC> Step 2 Find busy Street >>>DC> Step 3 Sit in middle of Street >>>DC> Step 4 goto Step 3 until sun goes down. >>>DC> Stpe 5 goto step 1 in the next day. >> >>>Tsk, tsk, bad advice. Goto's are evil! >> >>>Program Make_Money; >> >>>Uses >>> Nothing; >> >>>begin >>> Repeat >>> Find(EmptyCoffeeCup); >>> Find(BusyStreet); >>> Repeat >>> Sit(MiddleOfStreet) >>> Until Sun(Down) >>> Until Hell(FrozenOver) >>>end. >> >>>See mom, I DO have the Christmas spirit! >> >>> Dennis! >>Hey that's cool can you do it in Cobol? > >Sure: > >IDENTIFICATION DIVISION. >PROGRAM-ID MAKE-MONEY. >AUTHOR MY- ASS. >DATE-WRITTEN TODAY. >ENVIRONMENT DIVISION. > HOPEFULLY WARM. >DATA DIVISION. > >~~~~ YADA, YADA, YADA >01 HELL-IND PIC X VALUE SPACES. > 88 HELL-FROZEN VALUE 'Y'. >01 TIME-IND PIC X VALUE SPACES. > 88 SUN-DOWN VALUE 'Y'. > >PROCEDURE DIVISION. > >MAIN. > PERFORM DAILY-ROUNTINE UNTIL HELL-FROZEN. > STOP-RUN. > >DAILY-ROUTINE. > PERFORM FIND-EMPTY-COFFEE-CUP. > PERFORM FIND-SPOT WITH TEST AFTER UNTIL LOCATION = "GOOD". > PERFORM SIT UNTIL SUN-DOWN. > IF HELL-TEMP < 32 > MOVE "Y" TO HELL-IND. > >FIND-EMPTY-COFFEE-CUP. > FIND COFFEE-CUP. > IF COFFEE-CUP NOT = "EMPTY" > PERFORM EMPTY-CUP. > >EMPTY-CUP. > IF CUP-CONTENTS-APPEAR = "GOOD" > DRINK CUP-CONTENTS > ELSE > POUR CUP-CONTENTS. > >FIND-SPOT. > MOVE "GOOD" TO LOCATION. > FIND SPOT. > IF COP-PRESENT = "YES" > MOVE "BAD" TO LOCATION. > IF STREET-BUSY = "NO" > MOVE "BAD" TO LOCATION. > IF BULLETS-FLYING = "YES" > MOVE "BAD" TO LOCATION. > >SIT. > IF BUTT-ACHES > MOVE ASS TO OTHER-SIDE. > SIT STILL. > LOOK PITIFUL. > BEG. > PLEAD. > IF DARK="YES" > MOVE "Y" TO TIME-IND. > >Please note: This program was half the size, and worked twice as >well until administration got ahold of it and requested rewrites. Now >it is bigger, and nobody knows for sure what it does...... > >Enjoy.... > >Dave > >The opinions expressed in this post are purely my own. >You may e-mail replies to: renegade@dwx.com > My K&R is at work so I don't have anything to spot check my code against...might be a couple syntax errors here and there. #include #include enum { new, battered, travel, captains, porcelain } cupCondition_e; extern Streets; typedef { enum cupCondition_e condition; float amount; } coffeeCup_t; int main() { coffeeCup_t CoffeeCup; CoffeeCup.condition = battered; CoffeeCup.amount = 0f; for (i=0; i