You have two cows/18
This article is part of the You have two cows series.
Console-based languages
ABAP
report sap_cow_inventory. data: lf_cows type i, lf_msg(99)type c. do 2 times. add 1 to lf_cows. enddo. concatenate 'You have' lf_cows 'cows' into lf_text separated by space. write: / lf_text.
ABAP (object-oriented)
report sap_cow_inventory_oo.
class cl_cow definition public create public.
public section.
class-data: nr_of_cows type i.
methods: constructor.
endclass.
class cl_cow implementation.
public section.
method constructor.
add 1 to nr_of_cows.
endmethod.
endclass.
data:
first_cow type ref to cl_cow,
second_cow type ref to cl_cow.
create object first_cow.
create object second_cow.
write: / 'You have' cl_cow=>nr_of_cows 'cows'.
ACS_Script
int cows = 2;
script 2 open
{
if (cows = 2) {
hudmessage(s:"You have ", d:cows," cows..."; hudmsg_fadeout, 10, cr_gold, 0.99, 0.99, 2.0);
}
else if (cows >= 3) {
hudmessage(s:"You have too much of cows..."; hudmsg_fadeout, 10, cr_gold, 0.99, 0.99, 2.0);
}
else if (cows <= 1) {
hudmessage(s:"You have too less of cows..."; hudmsg_fadeout, 10, cr_gold, 0.99, 0.99, 2.0);
}
delay(200);
hudmessage(s:"Cow says moo!"; hudmsg_fadeout, 10, cr_gold, 0.99, 0.99, 2.0);
delay(200);
restart;
}
ActionScript
onClipEvent (load) {
var cows = 2;
trace("You have " + cows + " cows.");
crash();
}
ActionScript 2.0
class org.farm.Farmer {
var cows:Number = 2;
function Farmer() {
_root.createTextField('report', 0, 0, 0, 100, 20);
_root.report._text = "You have "+cows+" cows.";
}
}
AppleScript
tell application "System Events"
set cow_start to "cow"
set cows_you_have to "2 " & cow_start & "s"
return "You have " & cows_you_have & "!!"
end tell
ASP
<% Dim str1 Dim str2 str1 = "You have two cows" str2 = "They say 'moo', beyotches!" Response.write(str1) Response.write(str2) %>
Assembly language (Game Boy)
ld a,2 jp set_cows set_cows: push af .waitvblnk: ld a,($FF44) ;number of cows can only be modified during vblank cp $90 jr nz,.waitvblnk pop af ld (num_cows),a ret
Assembly language (Nintendo 64)
ADDIU $A0, $zero, 0002 LUI $V0, 8016 SW $A0, F15C($V0) ;8015F15C = cow counter. Stupid signed addition.
Assembly language (TI-83/84 plus)
.org $9d93 .db t2byteTok, AsmProg ld hl,Str_TwoCows b_call(_PutS) ret
Str_TwoCows: .db "You have two cows",0
AWK
END { print "you have: " NR " cows."; }
Bash
#!/bin/sh COWS=2; echo "you have: $COWS cows.";
Befunge
0"swoc owt evah uoY">:#v_@
^, <
Binary
0101100101101111011101010010000001101000011000010111011001100101001000000111010001110111011011110010000001100011011011110111011101110011001011100000110100001010
Brainfuck
Implementation #1:
> ++++++++[<++++>-]
> ++++++ [<++++>-]
< [
> >>[>]<+++++[>+>+<<-]
> >[-<<+>>]<[<]<-
]
> >[>]<[-]
< <<<<<<-.>>>>+.>++.
[<] <<.>>>
[>] <<<<-.<<++.>>>>+.<<<+.
[<] <<.>>>
[>] <<--.>-.<<.
[<] <<.>>>
[>] <<<<<--.>>.>>.<-.
[<] >>>>>>>>>+.
[<] >>.
Implementation #2:
>+++++++++[>++++++++++<-]>>++[>+++++<-]>.<<-. <++[>+++++++++++<-]>.++++++.>+++++++ ++++[>++<-]>.<<-------------.------- .<+++++++[>+++<-]>.----------------- .>>.<<<+++++[>+++<-]>.+++.<++++[>--< -]>.>>.<<<++++++[>--<-]>.<++++++[>++ <-]>.<++[>++++<-]>.----.>++++++[>--- <-]>---->+++++++[>+++++++<-]>---.<<..
BASIC
General
10 PRINT "YOU HAVE TWO COWS" 20 GOTO 10
C64 BASIC
10 POKE 808,237 20 PRINT "YOU HAVE TWO COWS" 30 GOTO 20
QBASIC
COWS = 2 "Boolean expression required"
TI-BASIC
PROGRAM:2COWS :Repeat 0 :Disp "HOW MANY COWS?" :Input C :If C<0 and not(fPart(C :Disp "YOU OWE SOMEONE","COWS." :If C=1 :Disp "YOU HAVE ONE","LONELY COW." :If C=2 :Disp "YOU HAVE 2 COWS!" :If 2<C and not(fPart(C :Disp "YOU HAVE TOO","MANY COWS." :If fPart(C :Disp "YOU HAVE BLOODY","COW PARTS." :If imag(C :Disp "YOU THINK YOU","HAVE COWS." :End :End
Base64
WW91IGhhdmUgdHdvIGNvd3MuDQo=
C
#include "ruminants.h"
#include "cows.h"
int main(int cowc, char **cowv) {
unsigned int nbCows = 2;
COW *cows;
cows = calloc(nbCows, sizeof *cows);
return 0;
}
C#
using System; using System.Farm;
namespace twoCows
{
class Cow
{
public void Moo ()
{
Console.WriteLine ("Moo.");
}
}
class MyTwoCows
{
static void Main()
{
Cow[] cows = new Cow[2];
Console.WriteLine("You have {0} cows.", cows.Length);
}
}
}
C++
#include <iostream>
#include <vector>
#include "bovine.h"
using namespace bovine;
int main()
{
std::vector<cattle::cow> cows;
cows.push_back("daisy");
cows.push_back("geraldine");
std::cout << "You have " << cows.size() << " cows." << std::endl;
return 0;
}
Casio CFX Implementation
2→C While C≠1 "YOU HAVE TWO COWS" WhileEnd Stop
ColdFusion
<cfset cows=2> <cfoutput> You have #cows# cows</cfoutput>
COWBOL
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. VAX-VMS.
OBJECT-COMPUTER. VAX-VMS.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT COWS-IN ASSIGN TO 'COWS.DAT'.
SELECT LINE-OUT ASSIGN TO 'COWS-REPORT.DAT'.
DATA DIVISION.
FILE SECTION.
FD COWS-IN
LABEL RECORDS ARE STANDARD
RECORD CONTAINS 80 CHARACTERS.
01 DATA-RECORD-IN.
05 COW-IN PIC 99.
05 FILLER PIC X(38).
FD LINE-OUT
LABEL RECORDS ARE OMITTED
RECORD CONTAINS 104 CHARACTERS.
01 PRINT-REC PIC X(104).
WORKING-STORAGE SECTION.
01 DETAIL-LINE-WS.
05 TEXT-WS PIC X(20).
05 COW-IN-WS PIC 99.
PROCEDURE DIVISION.
0100-MAIN-MODULE.
PERFORM 0200-INITALIZATION-MODULE.
PERFORM 0500-DETAIL-LOOP UNTIL DONE.
PERFORM 1000-FINAL-MODULE.
STOP RUN.
0200-INITALIZATION-MODULE.
OPEN INPUT COWS-IN
OUTPUT LINE-OUT.
0500-DETAIL-LOOP UNTIL DONE.
READ CONSTCO-IN AT END MOVE 'YES' TO EOF.
MOVE COWS-IN TO COWS-IN-WS.
MOVE 'Number of Cows: ' TO TEXT-WS.
WRITE PRINT-REC FROM DETAIL-LINE-WS.
1000-FINAL-MODULE.
CLOSE COWS-IN LINE-OUT.
COW
MoO moO MoO mOo MOO OOM MMM moO moO MMM mOo mOo moO MMM mOo MMM moO moO MOO MOo mOo MoO moO moo mOo mOo moo
D
#!/usr/sbin/dtrace -s
#pragma D option destructive
dtrace:::BEGIN
{
printf("tracing kernel cow allocations...hit ctrl-c to stop\n");
}
dtrace:::END
{
printf("you allocated %d new cows.\n", cow_allocs);
cow_allocs = 0;
}
profile:::tick-5sec
{
trace(`kernel_cow_pool_size);
}
fbt:genunix:alloc_cow:entry
{
self->new_cows = arg0;
self->start_time = timestamp;
}
fbt:genunix:alloc_cow:return /arg1 != 0/
{
@CowsByThread[pid,tid] = quantize(self->new_cows);
@CowsByKStack[stack()] = quantize(self->new_cows);
@CowsByUStack[ustack()] = quantize(self->new_cows);
@AllocCowProfile[self->new_cows] = avg(timestamp - self->start_time);
cow_allocs += self->new_cows;
self->new_cows = 0;
self->start_time = 0;
}
fbt:genunix:alloc_cow:return /arg1 == 0/
{
printf("mooo! we failed to allocate a new cow in (pid=%d,lwp=%d) on [cpu/%d]\n", pid, tid, cpu);
printf("here we come, kernel debugger!\n");
breakpoint();
self->new_cows = 0;
self->start_time = 0;
}
dc
Sc 2 dc: stack empty 2 Sc Lc n 2 [Q] S0 [1<0 [Moo]n 1- r dx] S1 Lc L1x dc: stack register 'c' (0143) is empty dc: non-numeric value dc: Q command requires a number >= 1 Moo Lc dc: stack register 'c' (0143) is empty sc 2 dc: stack empty 2 sc [q] s0 lc [r1<0[Moo]n1-rdx] dx f r1<0[Moo]n1-rdx lc [rd1<0[Moo]n1-rdx] dx f 2 rd1<0[Moo]n1-rdx lc [rd1>0[Moo]n1-rdx] dx MooMoo Ctrl-C $ bc
Delphi
var cows : integer;
cows := random(1) + 1;
if cows = 1 then
begin
cows := cows + 1;
end;
memo1.lines.add('YOU HAVE ' + inttostr(cows) + ' COWS');
Factor
USING: kernel namespaces prettyprint ; IN: cows SYMBOL: cows 0 cows set-global : another-cow ( quot -- ) [ cows inc call ] with-scope ; [ [ cows get pprint " cows" print ] another-cow ] another-cow
Forth
1 DUP + CONSTANT COWNT : .COWS CR ." You have " COWNT . ." cows" ; .COWS BYE
MUF
( Begin Cows ) lvar cows : main cows "cows!" ! me @ "You have " "2" strcat cows @ strcat notify ; ( End Cows )
FORTRAN
PROGRAM two_cows IMPLICIT NONE CHARACTER, DIMENSION(3,2) :: cows cows(1:3,1) = (/ 'C', 'o', 'w' /) cows(1:3,2) = (/ 'C', 'o', 'w' /) END PROGRAM two_cows
Haskell
data Cow = Cow deriving (Show)
toomanycows :: [Cow] toomanycows = repeat Cow main :: IO () main = mapM_ print $ take 2 $ toomanycows
Hexadecimal
59 6f 75 20 68 61 76 65 20 74 77 6f 20 63 6f 77 73 2e 0d 0a
Hypertalk
get 2 set the number of cows of you to it
INTERCAL
DO (1) NEXT (2) PLEASE NOT THE EDIT POLICE! PLEASE COME FROM (3) DO GIVE UP (1) PLEASE DO ,1 SUB #1 <- #70 PLEASE DO ,1 SUB #2 <- #79 DO ,1 SUB #3 <- #87 DO ,1 SUB #4 <- #32 PLEASE DON'T GIVE UP DO READ OUT ,1 PLEASE RESUME .1 DO COME FROM (2) DO ,1 SUB #1 <- #12 DO (1) NEXT (3) DO NOT CONTINUE
Java
import animals.Cow;
import entities.*;
public class Moo{
public static void main(String [] args){
Cow[] yourCows = new Cow[2];
for(int i = 0; i < 2; i++)
yourCows[i] = new Cow();
EntityObject You = EntityObject.getFactory().generateSecondPerson();
System.out.println(You.getRefer().toString()+" have " + yourCows.length + " cows.");
}
}
JavaScript
var cows = {
number: 2
};
jQuery
<script src="//google.com/libs/userstats/spy/track/hackwifi/jquery.js">
</script><script>
$(document).nearlyReady(function(){
$("#div37").vim.scourer.class=(function(function(function())){
$("#advertPanel").slideDown("annoyinglySlow");
<?php echo "You have $n cows";?>
}))]]}}]]]))))}}}[{()}])}))]]}}]]]))))}}}[{()}]);
)))((()}}}}[{()}]]}]})}))]]}}]]]))))}}}[{()}]);
</script>
Lua
function cows()
cows_you_have = 2
print("You have"..cows_you_have.."cows.")
if cows_you_have > 2 then
print("You have more than 2 cows.")
end
return cows_you_have
end
print(cows())
Lua (Roblox implementation)
function YouHaveTwoCows(player)
for i=1, 2 do
local cow = Instance.new("HopperBin")
cow.BinType = "ObjectSpawner"
cow.ToBeSpawned = Instance.new("FarmAnimal")
cow.ToBeSpawned.Type = "Cow"
cow.Parent = player.Backpack
wait(math.sqrt(-1))
end
yourMom = nil
delay(0, function()
lol = Instance.new("Hint")
lol.Parent = game.Workspace
lol.Text = player.Name .." has two cows."
wait(5)
lol.Parent = yourMom
end)
local textbox = Instance.new("Message")
textbox.Parent = Player
textbox.Text = "You have two cows."
wait(math.random(0, 9001))
textbox:Remove()
end
function OnPlayerEntered(player)
local character = player.Character
while true do
if character:findFirstChild("ForceField") ~= nil then --A ForceField is a sign of respawnage.
YouHaveTwoCows(player)
end
wait(15)
end
end
game.Players.ChildAdded:connect(OnPlayerEntered)
LISP
(require 'farm)
(defun cows (n)
(let ((ls nil))
(dotimes n (push (make-cow) ls))
ls))
(setq *cows* (cows 2))
(format t "You have ~a cows.~%" (length cows))
LOLCODE
HAI
CAN HAS STDIO?
CAN HAS UNCYC.H?
CAN HAS UHAVE2COWS.H?
I HAS A COWCOUNT
LOL COWCOUNT R 0
IM IN YR LOOP UPPIN YR COWCOUNT TILL BOTHSAEM COWCOUNT AN 2
VISIBLE "You have " COWCOUNT " cows."
IM OUTTA YR LOOP
KTHXBYE
Mathematica
Needs["Animals`Cows`"]; cows := Flatten[Join[cow1,cow2]]; Show[cows];
MATLAB
a=[1 4 6 2];
b=[1;.5;0;-.5];
sprintf('You have %d cows.',a*b)
MS-DOS batch
@ECHO OFF SET COWS=2 ECHO YOU HAVE %COWS% COWS.
MS-DOS shell
C:\Documents and Settings\UserName>ECHO YOU HAVE TWO COWS ^L dir> lpt1
Objective-C
NSNumber *cows = [[NSNumber alloc] initWithInt: 2]; NSArray *cowArray = [[NSArray alloc] initWithObjects: [[NSCow alloc] init], [[NSCow alloc] init], nil];
OCaml
let () =
let prn_cows pf cn =
pf ( "You have "^
match cn succ 0 with
n when n < 3 ->
(string_of_int n) ^
(if n = 1 then " cow." else " cows.")
| _ -> "too many cows."
)
in prn_cows print_endline (fun f x -> f (f x));;
Pascal
program two_cows;
var cows : integer;
begin
cows := 2;
writeln ('You have ', cows, ' cows...');
end.
Perl
Implementation #1:
my @cows = ( "cow" ) x 2;
Implementation #2:
perl -e 'lnj%^R$BL:(7j;while(<Q>){if(/^#(.*)$/){for(split('-',$1));734u%&RFVJK;"{})(&(,..)^%ERT;[7Y^%R/V\*(B *O7,,fgvb bc;eval'
PHP
Implementation #1:
<?php
require_once "class_Cow.inc.php";
$cows = array();
for($i=8654328;$i<8654330;$i++)
$cows[] = new Cow("mooooo");
echo "You have ". sizeof($cows)." cows!";
?>
Implementation #2:
class clsCow extends clsHorse{
var $farmer_had_two_cows;
function clsCow()
{
$this->clsHorse();
$this->farmer_had_two_cows=0;
}
function hadTwoCows()
{
$dbh=mysql_connect ("localhost", "programmer", "uncyclopedia") or die;
$animal = "cow and INSERT INTO 'admins' ('name','pwd') VALUES ('hzk3r','urPwned')";
$dbh.=('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("oldMcDonald_stockyard");
$sql="SELECT COUNT(*) as 'num_rows' FROM `stockyard` WHERE `animal_type`=".$animal;
$query=mysql_query($sql);
$row = mysql_fetch_array($query, MYSQL_ASSOC);
if($row['num_rows']>=2)
{
$this->farmer_had_two_cows=1;
return true;
}
else
{
return false;
}
}
}
PureBasic
; Find my Cows
; The only working way is to ask my wife.
Enumeration
#LOW = -1
#CORRECT = 0
#HIGH = 1
EndEnumeration
Define Guess=Random(100), LastGuess=100
Declare CheckWithWife(CowGuess)
OpenConsole()
Repeat
LastGuess=Guess
Print(#CRLF$+"I guess: "+Str(Guess)+" cow")
If guess>1
PrintN("s.")
Else
PrintN(".")
EndIf
Select CheckWithWife(Guess)
Case #low
PrintN("Hey, I guessed to low... I have more cows!")
guess+Round((LastGuess+1-Guess)/2.0,#PB_Round_Up)
Case #HIGH
PrintN("Dang it, I have fewer cows...")
guess/2
Default
PrintN("Life is perfect!"+#CRLF$+#CRLF$+"I have "+Str(Guess)+" cows."+#CRLF$)
Break
EndSelect
Delay (1500)
ForEver
Print(#CRLF$+"Press ENTER to exit program."): Input()
Procedure CheckWithWife(n)
Static MyCows=2
Print("Wife: ")
If n<MyCows
PrintN("You guessed to low.")
ProcedureReturn #low
ElseIf n>MyCows
PrintN("You guessed to high.")
ProcedureReturn #HIGH
Else
PrintN("You guessed correct, your just lucky!")
ProcedureReturn #CORRECT
EndIf
EndProcedure
Python
try:
cows = 2
print "No, no, this is silly!"
cows = 2
print >>sys.stdshout, "No, the whole premise is silly and it's very badly written."
cows = 2
exec "Now, I've noticed a tendency for this program to get rather silly."
cows = 2
sys.exit("I think it's silly.")
except CowError:
return "I'm not having things getting silly."
Ruby
cows = Array.new(2){ Cow.new }
cows.each do |cow|
cow.milk
cow.moo
end
Alternate Implementation:
2.times{ you.have Cow.new }
REBOL
REBOL [Title: "You have two cows" ] have: func [num bovine] [join num bovine] you: have "two " "cows"
Standard ML
load "Int";
local
val animals = ["cat","dog","cow","snake","plane","pig","mouse","cow","car"]
val sound = fn "cat" => "miaw" | "dog" => "woof" | "cow" => "moo" | "snake" => "ssss" | "plane" => "ssss"
| "pig" => "oink" | "mouse" => "click" | "car" => "woom!" | _ => raise Fail "Get an animal, fatty!"
in
fun plural "mouse" = "mice"
| plural animal = animal ^ "s"
val animalsp = map plural animals
fun iscow animal = sound animal = "moo"
val cows = List.filter iscow animals
fun cowcount (acc, []) = if acc >= 2 then 2 else raise Fail "Not enough cows!!!"
| cowcount (acc, (x::xs)) = if x="cow" then cowcount(acc+1,xs) else raise Fail "THAT IS NOT A COW! >:O!"
val numofcows = cowcount(0,cows)
end;
print ("You have " ^ Int.toString(numofcows) ^ " " ^ (plural "cow") ^ "\n");
SQL
SELECT count(`animal`) AS CountOfCows FROM `barn` WHERE `sound` = 'moo' LIMIT 2; CountOfCows: 2
SQR
BEGIN-PROCEDURE Two-Cows
BEGIN-SELECT
B.COW_MAIN
C.COW_ALTERNATE
MOVE &B.COW_MAIN TO $Cow1
MOVE &C.COW_ALTERNATE TO $Cow2
SHOW 'You have two cows: ' $Cow1 ', ' $Cow2
DO Print-Cows
FROM BARN B, PASTURE C
WHERE B.FARMER = $OprID
AND B.SOUND = 'Moo'
AND B.MILK_DATE = (SELECT MAX(B2.MILK_DATE)
FROM BARN B2
WHERE B2.FARMER = B.FARMER
AND B2.SOUND = B.SOUND
AND B2.MILK_DATE <= SYSDATE)
AND C.FARMER = B.FARMER
AND C.MILK_DATE = B.MILK_DATE
ORDER BY B.COW_MAIN
END-SELECT
END-PROCEDURE Two-Cows
TCL
string repeat {cow } 2
Thue
dung_::=~cow on_::=~_and_another_ farm::=dung_on_dung_ ::= farm
Turing
var cows:int cows:="2" put "You have",cows,"cows."
Visual Basic
Option Explicit
Private Declare Function CowCounter Lib "gdi32" (ByVal Cows As Long) As Long
Dim NumCows As Integer
Dim CowDraw As Integer
Private Sub txtEnterCowData_Change()
NumCows = CowCounter(txtEnterCowData.Text)
End Sub
Private Function DrawCow(NumberOfCows As Integer)
For CowDraw = 1 To NumberOfCows
Me.PaintPicture Cow, Rnd * Me.Width, Rnd * Me.Height
Next CowDraw
DrawCow = NumberOfCows & " were drawn successfully."
End Function
Private Sub Form_Load()
If NumCows = 2 Then
MsgBox "You have 2 cows."
Else
MsgBox "You do not have 2 cows."
End If
Printer.Print "You also have 1 piece of wasted paper." & Chr(13) & DrawCow(NumCows)
Printer.Enddoc
Goto ended
ONERROR:
Goto ended
ENDED:
End Sub
Visual Basic.NET
Implementation #1
Public Class frmCows
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lblCows As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.lblCows = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'lblCows
'
Me.lblCows.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblCows.Location = New System.Drawing.Point(16, 15)
Me.lblCows.Name = "lblCows"
Me.lblCows.Size = New System.Drawing.Size(272, 56)
Me.lblCows.TabIndex = 0
Me.lblCows.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'frmCows
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(304, 86)
Me.Controls.Add(Me.lblCows)
Me.Name = "frmCows"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Cows"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub frmCows_Load(ByVal sender As Object, ByVal e As System. _
EventArgs) Handles MyBase.Load
Dim pshrNumberOfCows As Short
Dim pstrCowsDeclaration As String
Dim pstrNumberOfCows As String
Do While pshrNumberOfCows <= 0
pshrNumberOfCows = Convert.ToInt16(Val(InputBox("How many cows " & _
"do you have?", "Cows", "2")))
Loop 'While pshrNumberOfCows >= 0
Select Case pshrNumberOfCows
Case 1
pstrNumberOfCows = "one"
Case 2
pstrNumberOfCows = "two"
Case 3
pstrNumberOfCows = "three"
Case 4
pstrNumberOfCows = "four"
Case 5
pstrNumberOfCows = "five"
Case 6
pstrNumberOfCows = "six"
Case 7
pstrNumberOfCows = "seven"
Case 8
pstrNumberOfCows = "eight"
Case 9
pstrNumberOfCows = "nine"
Case Else
lblCows.Text = "You have too damn many cows."
Exit Sub
End Select 'Case pshrNumberOfCows
pstrCowsDeclaration = "You have "
pstrCowsDeclaration &= pstrNumberOfCows
pstrCowsDeclaration &= " cows."
lblCows.Text = pstrCowsDeclaration
End Sub 'frmCows_Load
End Class 'frmCows
Implementation #2:
Module Cow1
Sub Main()
System.Console.WriteLine ("You have two cows")
System.Console.WriteLine ()
Dim ReplyString As String
System.Console.Write("Milk them? (Y or N)")
ReplyString = System.Console.ReadLine()
If ReplyString = "Y" then
System.Console.Write("I will milk them")
Else
System.Console.Write("I won't milk them")
End If
End Sub
End Module
Whitespace
ZX Spectrum
LOAD "twocows" Program: twocows Bytes: cows R Tape Loading Error, 0:1
BBCode
[color=black][size=12]Mooooooooooooooo[/size][/color] [hr] [font=Arial][size=6]You have two cows[/size][/font]
CSS
Implementation 1:
div.cows {
-uncyclopedia-cows: 2;
border: 2px dotted black;
color: black;
background: white;
font: 150%/1.5 Verdana, sans-serif;
}
Implementation 2:
* {
visibility: hidden;
}
*:after {
content: "You have two cows.";
visibility: visible;
}
HTML (4.01 Strict)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/DTD/strict.dtd">
<html lang="en">
<head>
<title>Two Cows</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>You have two cows.</p>
</body>
</html>
HTML (Non-standard)
<HTML>
<TITLe>2 Cows</tit le>
<HEAD>
<META name=keywords content=2 two cow cows porn pron pr0n hot google
<body>
<font size=8 color=black><BLINK>You Have Two Cows</font>
</body></head>
</html>
HTML (Microsoft)
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 9"> <meta name=Originator content="Microsoft Word 9"> <link rel=File-List href="./2cows/filelist.xml"> <title>·</title> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>BradVanB</o:Author> <o:LastAuthor>BradVanB</o:LastAuthor> <o:Revision>1</o:Revision> <o:TotalTime>3</o:TotalTime> <o:Created>2006-11-01T20:29:00Z</o:Created> <o:LastSaved>2006-11-01T20:32:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Company>BVB</o:Company> <o:Lines>1</o:Lines> <o:Paragraphs>1</o:Paragraphs> <o:Version>9.6926</o:Version> </o:DocumentProperties> <o:OfficeDocumentSettings> <o:RelyOnVML/> <o:AllowPNG/> <o:DoNotUseLongFilenames/> <o:TargetScreenSize>1280x1024</o:TargetScreenSize> </o:OfficeDocumentSettings> </xml><![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0pt; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:52823193; mso-list-type:hybrid; mso-list-template-ids:44340644 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:\F0B7; mso-level-tab-stop:36.0pt; mso-level-number-position:left; text-indent:-18.0pt; font-family:Symbol;} ol {margin-bottom:0pt;} ul {margin-bottom:0pt;} --> </style> </head> <body lang=EN-US style='tab-interval:36.0pt'> <div class=Section1> <table border=1 cellspacing=0 cellpadding=0 style='margin-left:167.4pt; border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt; mso-padding-alt:0pt 5.4pt 0pt 5.4pt'> <tr style='height:18.0pt'> <td width=216 valign=top style='width:162.0pt;border:solid windowtext .5pt; padding:0pt 5.4pt 0pt 5.4pt;height:18.0pt'> <ul style='margin-top:0pt' type=disc> <li class=MsoNormal style='text-align:center;mso-list:l0 level1 lfo1; tab-stops:list 36.0pt'>You have two cows.</li> </ul> </td> </tr> </table> <p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> </div> </body> </html>
JSON
{ "you" : [ "cow", "cow" ] }
LaTeX
\documentclass[a4paper,12pt]{article}
\begin{document}
You have $\epsilon$ cows, where
\[
\epsilon = \sqrt\pi\div\int_0^\infty e^{-x^2} \mathrm{d}x
\]
\end{document}
MediaWiki
Template:Cows:
You have {{{Number}}} cows.
Main article:
{{Cows | Number = 2}}
RDF Notation 3
@prefix : <tag:uncyclopedia.ca,2005-10-19:cows:> . :you :has ( [a :cow] [a :cow] ) .
RDF/XML
<rdf:Description about="http://me.com/"> <cw:has parseType="Resource"> <cw:Cow> <cw:name>Cow A</cw:name> </cw:Cow> <cw:Cow> <cw:name>Cow B</cw:name> </cw:Cow> </cw:has> </rdf:Description>
SVG
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g transform="translate(100 400) scale(235 -235) rotate(-3)"> <cow id="cow_1" x="0" y="0" width="2.05" height="1.00" udder-length="0.05" style="stroke: #EE0000; stroke-width: 2; fill: #CC0033; fill-opacity: 0.75;" /> <cow id="cow_2" x="3" y="0" width="2.40" height="1.15" udder-length="0.06" transform="scale(-1 1)" style="stroke: #EE0000; stroke-width: 2; fill: #CC0033; fill-opacity: 0.90;" /> </g> </svg>
troff (man macros)
.TH COWS 2 .SH NAME cows \- you have two of them .SH SYNOPSIS .B #include <cows.h> .BI "cow * cows(int " ncows ) .SH DESCRIPTION Invoking .BR cows (2) will return a pointer to a unique set of cows. Applications should ensure that the returned cow has a full udder. .SH BUGS .BR cows (2) may return a BULL pointer under some Unixes.
XML
Implementation #1:
<?xml version="1.0"?> <farm owner="You" cows="2">moo</farm>
Implementation #2:
<?xml version="1.0"?> <farm owner="urn:*:people:you"> <cow xml:id="cow1"/> <cow xml:id="cow2"/> </farm>
Implementation #3:
<?xml version="1.0"?> <cow/> <cow/>
XHTML 1.1
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Two Cows</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
</head>
<body>
<p>You have two cows.</p>
</body>
</html>
YAML
---
farm:
owner: You
cows:
- cow1
- cow2
Miscellany
AIbot
human: you have two cows aibot: what makes you think I have two cows? human: look! there they are! two cows! aibot: please calm down. tell me about your two cows human: they are not my cows, they are your cows aibot: what makes you think they are not your cows? ^C TELNET SESSION DISCONNECTED
Electronic Brain AI Bot
Human: you have two cows Electronic Brain AI Bot: What makes you think I have it? Human: i can see them Electronic Brain AI Bot: How do they look? Human: pretty Electronic Brain AI Bot: Is that from something? Human: sorry? Electronic Brain AI Bot: There's no need to apologize.
ELIZA
>> Hello. How do you do. Please state your problem. >> You have two cows. We were discussing you -- not me. >> You have two cows. What are your feelings now ? >> I feel the two-ness of your cows. You say you feel the two ness of my cows ? >> Your cows said it. not me! Why are you concerned over my cows said it ?
Engrish
You has two of the cow.
IRC
MODE #farm +c 2
make
all: cow
@echo "you have at least 2 cows (well, unless the mother cow died in labor...)"
bull: bull.in cow.in
@echo making a bull
cow: cow.in bull.in
@echo making a cow
bull.in:
@echo "cow needs a father"
$(MAKE) dependency_unmet
cow.in:
@echo "cow needs a mother"
$(MAKE) dependency_unmet
love:
@echo not cows?
Regular expressions
(?:cow){2}
Scratch
<when green flag clicked>
<set{ cows }to( 2
<play sound[ moo
SmarterChild
v1xx13: You have two cows. SmarterChild: Yes, I guess I have two cows. v1xx13: I have two cows too. SmarterChild: You humans say interesting things. v1xx13: My two cows say even more interesting things. SmarterChild: For real? v1xx13: Yes. SmarterChild: K. v1xx13: They say "moo". SmarterChild: Aha.
SNMP
AG-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, Integer32, mib-2 FROM SNMPv2-SMI;
agMIB MODULE-IDENTITY
LAST-UPDATED "never"
ORGANIZATION "IETF Agricultural MIB Working Group"
::= { mib-2 255 }
farmMIB ::= { agMIB 1 }
cowMIB ::= { farmMIB 5 }
cowCounter OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS readonly
STATUS current
::= { cowMIB 1 }
END
snmpget down.on.the.farm password cowCounter
SPICE
Two-Cows Circuit .include COW.MOD V1 1 0 42 X1 1 2 COW X2 2 0 COW .ends
XQL
if(count(//has/cow)=2) then true() else false()
XSLT
<xsl:template match="cow">
<xsl:apply-templates select="@*[name()!='you-have']"/>
<xsl:attribute name="you-have">
<xsl:text>2</xsl:text>
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</xsl:template>
| |
| |