Jump to content



Photo

Programmer logic in everyday life

joke joke

  • Please log in to reply
35 replies to this topic

#16 *RedBull*

*RedBull*

    skippy de do da

  • 4,640 posts
  • Joined: 30-March 06
  • Location: Everywhere and No where
  • OS: Windows 8 professional
  • Phone: Android

Posted 06 June 2012 - 03:41

I don't see the joke. the senario is completely logical.

6 bottles of milk bitch! that's what you asked for, suck em down!

Yeah a few more anger control classes to go to.... :/


#17 -Alex-

-Alex-

    Noob Hunter

  • 2,761 posts
  • Joined: 08-August 06
  • Location: Oslo, Norway

Posted 06 June 2012 - 03:44

:D I like the ternary operator version as well:

int
get_milk()
{
	return ( shop_has_eggs() ) ? 6 : 1;
}


Just cos I want mine to be shorter :p

<? $milk = ($eggs ? 6 : 1) ?>


#18 moloko

moloko

    Neowinian Senior

  • 2,712 posts
  • Joined: 28-December 02

Posted 06 June 2012 - 03:56

that is pretty good.

#19 vetAndrew Lyle

Andrew Lyle

    Don't Panic!

  • 31,935 posts
  • Joined: 15-December 03
  • Location: Toronto, Ontario
  • OS: Windows 7 SP1

Posted 06 June 2012 - 04:38

Hahaha that's good :D

#20 Mohitster

Mohitster

    Neowinian

  • 1,452 posts
  • Joined: 12-October 05
  • Phone: Lumia 525

Posted 12 June 2012 - 08:33

lol :D

#21 CPressland

CPressland

    www.absolute.com

  • 6,854 posts
  • Joined: 16-September 06
  • Location: England
  • OS: OS X Mavericks

Posted 12 June 2012 - 08:35

Hahaha! Legendary!

#22 Ice_Blue

Ice_Blue

    Neowinian

  • 1,385 posts
  • Joined: 02-February 09
  • Location: The Den Of Zen
  • OS: Windows 8.1 Pro x64
  • Phone: Nokia N8 Belle

Posted 01 December 2012 - 22:16

Not sure this hasn't been posted before. If it has, I apologise. (I searched before posting.)

My mother told me:
Go to the grocery store and get me two bottles of milk. If they have eggs, buy six.

When I returned, she looked inside the bag and shrieked: "Why the hell did you buy six bottles of milk?"

I replied: "Because they had eggs."

#23 Arceles

Arceles

    Time Craymel

  • 2,101 posts
  • Joined: 28-November 09
  • Location: 4th dimmension.
  • OS: Win 7 Ultimate / Win 8.1 Pro (With Start Menu Start8, otherwise is UNUSABLE) / Android 4.1.2 Jelly Bean
  • Phone: XT890 Motorola RAZRi (x86 processor)

Posted 01 December 2012 - 22:27

Yup... I relate :D

#24 Arceles

Arceles

    Time Craymel

  • 2,101 posts
  • Joined: 28-November 09
  • Location: 4th dimmension.
  • OS: Win 7 Ultimate / Win 8.1 Pro (With Start Menu Start8, otherwise is UNUSABLE) / Android 4.1.2 Jelly Bean
  • Phone: XT890 Motorola RAZRi (x86 processor)

Posted 01 December 2012 - 22:32

TL:DR

#include <stdio.h>

int main(void)
{
BuyMilk = 2;
if (Eggs == TRUE) {BuyMilk = 6;}
return 0;
}

#25 Stoffel

Stoffel

    Being on the ocean is cooler then being in front of a Computer

  • 2,092 posts
  • Joined: 16-August 11
  • Location: Utila, Honduras
  • OS: Windows 8.1 Update 1
  • Phone: WP 8.1 Update

Posted 01 December 2012 - 23:02

That was funny!

#26 Phouchg

Phouchg

    has stopped responding

  • 5,689 posts
  • Joined: 28-March 11

Posted 01 December 2012 - 23:05

int GroceryShopping() {
    return Buy("Milk", g_Eggs ? 2 : 6);
}

:shiftyninja:

#27 KRazpopov

KRazpopov

    Neowinian

  • 486 posts
  • Joined: 27-April 10
  • Location: Sofia, Bulgaria
  • OS: Windows 8 Pro
  • Phone: Samsung Omnia 7

Posted 01 December 2012 - 23:13


local BuyMilk = 2

if Eggs == true then

   BuyMilk = 6

end

print (BuyMilk)



#28 Buttus

Buttus

    Neowinian Senior

  • 3,360 posts
  • Joined: 07-September 05

Posted 01 December 2012 - 23:20

ok, someone, quick! x86 assembly!

#29 Radium

Radium

    Neowinian

  • 1,279 posts
  • Joined: 08-April 04

Posted 02 December 2012 - 00:08

ok, someone, quick! x86 assembly!


proc BuyMilk

cmp 0, dwEggCount
jz @F ;ZF set? Jump [b]f[/b]orward
mov eax, 6 ;Has eggs, buy 6 milk.
ret

@@:
mov eax, 2 ;Has zero eggs, buy 2 milk
ret

BuyMilk endp

I haven't played with assembly in a few years, but I guess that code would do if dwEggCount exists. :p
Just make sure that the amount of eggs is stored in dwEggCount and call BuyMilk to return how much milk that should be bought.
I used MASM when I played with it. A few modifications are needed to make it work for others.
I love @@-labels.

#30 Hum

Hum

    totally wAcKed

  • 63,247 posts
  • Joined: 05-October 03
  • Location: Odder Space
  • OS: Windows XP, 7

Posted 02 December 2012 - 00:18

Not sure this hasn't been posted before. If it has, I apologise. (I searched before posting.)


Yep -- posted back in June:

http://www.neowin.ne...g-a-programmer/

I just had to be a little smart alec :p