Joke programs from my cs 135 class

A place to discuss the science of computers and programs, from algorithms to computability.

Formal proofs preferred.

Moderators: phlip, Moderators General, Prelates

gd1
Posts: 91
Joined: Wed Nov 14, 2012 5:42 am UTC

Joke programs from my cs 135 class

Postby gd1 » Fri Sep 22, 2017 4:29 pm UTC

#include <stdio.h>

int main (void)
{
char declarationofindependence[] = "When in the Course of human events...";
printf("%s\n", declarationofindependence);

return 0;
}

because we were talking about declarations in class (though I think that might not be?)

=========================================

//Prints dance to the screen using a switch and break statements then prints break
#include <stdio.h>
int main(void)
{
int breakdance;

printf("Enter a number of times from 1 to 5 to print dance: ");
scanf("%d", &breakdance);
switch (breakdance)
{
case 1: printf("Dance\n"); break;
case 2: printf("Dance\nDance\n"); break;
case 3: printf("Dance\nDance\nDance\n"); break;
case 4: printf("Dance\nDance\nDance\nDance\n"); break;
case 5: printf("Dance\nDance\nDance\nDance\nDance\n"); break;
default: printf("\n"); break;
}
printf("Break\n");
return 0;
}

because we were talking about breaks in class

Feel free to also post your joke programs or ones you like.

Mike Rosoft
Posts: 63
Joined: Mon Jun 15, 2009 9:56 pm UTC
Location: Prague, Czech Republic

Re: Joke programs from my cs 135 class

Postby Mike Rosoft » Fri Sep 22, 2017 5:19 pm UTC

Text adventure game (for two players):

Code: Select all

10 INPUT a$
20 PRINT a$
30 GO TO 10


Return to “Computer Science”

Who is online

Users browsing this forum: No registered users and 4 guests