"Hello DIC" in every programing language

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »

66 Replies - 8671 Views - Last Post: 25 November 2010 - 04:47 PM

#16 computerfox   User is offline

  • straight vegetarian kid

Reputation: 50
  • View blog
  • Posts: 3,772
  • Joined: 29-January 09

Re: "Hello DIC" in every programing language

Posted 01 March 2009 - 01:14 PM

#include<iostream>
#include<string>
using namespace std;

void helloWorld(string a);
int main()
{
	 string name;

	 cout<<"Please enter name: ";
	 cin>>name;

	 helloWorld(name);

	 return 0;
}

void helloWorld(string a)
{
	 cout<<"\n welcome to the DIC family "<<a<<"\n";

	 return;
}



This post has been edited by computerfox: 01 March 2009 - 01:15 PM


#17 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: "Hello DIC" in every programing language

Posted 01 March 2009 - 09:18 PM

Korn Shell :

#!/bin/ksh

read name?"Type your name: "

echo "Hello, ${name}. Welcome to Dream.In.Code"


C
#include <stdio.h>

int main(void) {
  char _name[256];
  printf("Type your name: ");
  scanf("%s",_name);
  printf("Hello, %s. Welcome to Dream.In.Code\n",_name);

  return 0;
}



Javascript
<html><head>
<script language="Javascript">
<!--	
function hello(Name) {
	alert("Hello " + Name.value + ". Welcome to Dream.In.Code");
}
-->
</script>
</head>
<body>
<form>
Type your name: <input id="_name" type=text name="_name" value=""><br>
<input class="submit" type="button" onclick="hello(_name)" value="Submit">
</form></body></html>



#18 OliveOyl3471   User is offline

  • Everybody's crazy but me!
  • member icon

Reputation: 135
  • View blog
  • Posts: 6,581
  • Joined: 11-July 07

Re: "Hello DIC" in every programing language

Posted 01 March 2009 - 09:52 PM

Guess

<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
<meta http-equiv = "content-type" content = "text/html; charset = iso-8859-1" />

</head>
<body>
<script type="text/javascript">
var name=(prompt("Enter name: ",""));
	/* <![CDATA[ */
document.write("<p><h3>Hello " + name + " . Welcome to Dream In Code, where all your wildest dreams come true!</h3></p>");
	/* ]]> */
</script>
</body>
</html>


:P

#19 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1663
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: "Hello DIC" in every programing language

Posted 03 March 2009 - 12:05 AM

LOLCODE

HAI
   CAN HAS STDIO?
   I HAS A YERNAME
   VISIBLE "Please enter your name..."
   GIMMEH LINE YERNAME
   VISIBLE "Hello "!
   VISIBLE YERNAME!
   VISIBLE ", Welcome to Dream.In.Code"
KTHXBYE



#20 5thWall   User is offline

  • Occasional Member

Reputation: 31
  • View blog
  • Posts: 530
  • Joined: 17-September 08

Re: "Hello DIC" in every programing language

Posted 03 March 2009 - 01:07 AM

Slag (see my sig)

[mainClass hello]

class hello
  METHODS
	method init:
	  local var name = input_String( "What is your name?\n" )
	  println( "Hello $. Welcome to Dream In Code" (name) )
endClass


This post has been edited by 5thWall: 03 March 2009 - 01:14 AM


#21 krzysz00   User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 83
  • Joined: 25-February 09

Re: "Hello DIC" in every programing language

Posted 03 March 2009 - 06:16 AM

View PostOliveOyl3471, on 1 Mar, 2009 - 09:52 PM, said:

Guess

<snip>

:P

Javascript?

#22 gabehabe   User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1440
  • View blog
  • Posts: 11,025
  • Joined: 06-February 08

Re: "Hello DIC" in every programing language

Posted 03 March 2009 - 06:22 AM

Cool idea. I'll do one in brainfuck later. :)

Until then~

echo Yo! What's your name?
set name=
echo Welcome to Dream.In.Code, %name%

[batch script]

It's been ages since I wrote ANY batch. :)

#23 WolfCoder   User is offline

  • Isn't a volcano just an angry hill?
  • member icon


Reputation: 828
  • View blog
  • Posts: 7,696
  • Joined: 05-May 05

Re: "Hello DIC" in every programing language

Posted 06 March 2009 - 11:51 AM

C

/*
	Hello, Dream.In.Code!
	written by WolfCoder (2009)
*/

/* Defines */
#define MAX_CHAR 512

/* Includes */
#include <stdio.h>

/* Program entry */
int main()
{
	char name[MAX_CHAR];
	/* Greet the user */
	printf("What is your name? ");
#ifdef WIN32
	gets_s(name,MAX_CHAR);
#endif
#ifndef WIN32
	gets(name,MAX_CHAR);
#endif
	printf("Welcome to Dream.In.Code, %s!\n",name);
	/* Return normal operation code */
	return 0;
}



JAVA

// Hello, Dream.In.Code!
// written in noobscode
// written by WolfCoder (2009)

// Imports
import javax.swing.JOptionPane;

// Main program
public class HelloDIC
{
	// Program entry
	public static void main(String[] args)
	{
		// Ask for the name
		String name = JOptionPane.showInputDialog("What is your name?");
		// Respond
		JOptionPane.showMessageDialog(null,"Welcome to Dream.In.Code, "+name+"!");
	}
}



Mine is the shortest yet, with just two commands issued. Furthermore, it opens a dialog box and enters name and everything instead of a console output.

Scheme

;; Hello Dream.In.Code!
;; Pretty pointless language to use for something like this ^ ^
(define dream-in-code-hello
  (lambda ()
	(display "What is your name? ")
	(let ((name (read)))
	  (display "Welcome to Dream.In.Code, ")
	  (write name)
	  (display ".")
	)
  )
)



#24 ericr2427   User is offline

  • D.I.C Regular
  • member icon

Reputation: 40
  • View blog
  • Posts: 378
  • Joined: 01-December 08

Re: "Hello DIC" in every programing language

Posted 09 March 2009 - 05:24 PM

Quote

HAI
CAN HAS STDIO?
I HAS A YERNAME
VISIBLE "Please enter your name..."
GIMMEH LINE YERNAME
VISIBLE "Hello "!
VISIBLE YERNAME!
VISIBLE ", Welcome to Dream.In.Code"
KTHXBYE

That's epic.

#25 AdamSpeight2008   User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: "Hello DIC" in every programing language

Posted 10 March 2009 - 03:16 PM

View Postgabehabe, on 3 Mar, 2009 - 12:22 PM, said:

Cool idea. I'll do one in brainfuck later. :)

Sorry gabehabe I bet you to it.
[-]>[-]<
>++++++++[<+++++++++>-]<.
---.
+++++++.
.
+++.
>++++++[<-------->-]<+.
[-]+[,>++++++++++[<->-]<]
[-]>[-]<
>++++[<++++++++>-]<.
>+++++[<+++++++++++>-]<.
>+++[<------>-]<.
+++++++.
---------.
++++++++++++.
--.
--------.
>++++++[<------>-]<-.
>++++[<+++++++++++++>-]<.
-----.
>++++++[<-------->-]<+.
>++++++[<++++++>-]<.
++++++++++++++.
-------------.
----.
++++++++++++.
>+++++[<--------->-]<.
>+++++[<++++++++>-]<+.
+++++.
>+++++[<--------->-]<-.
>+++++[<+++++++>-]<.
++++++++++++.
-----------.
+.



#26 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: "Hello DIC" in every programing language

Posted 12 March 2009 - 04:28 AM

x86 : Linux
; nasm -f elf -o input.o input.asm
; ld -s -o input input.o
section .data
var:  DB 0			; declare var with value 0
don:  DB 10		; declare our done value at 10
msg:  DB "Please enter your name: "
len:  equ $-msg	; the length of msg
dic:  DB "Welcome to Dream In Code, "
dic_ln: equ $-dic
buffer: DB "					"; input buffer = 20 bytes
bf_sz: equ $-buffer

section .text
global _start

_start:
  mov eax, 4; pass sys_write
  mov ebx, 1; stdout
  mov ecx, msg; Load register ecx with prompt msg
  mov edx, len; Load register edx with length of msg
  int 0x80	; return to the kernel
  jmp stdin  ; Go to input function

stdout:
   mov eax, 4; pass sys_write
   mov ebx, 1; stdout
   mov ecx, dic
   mov edx, dic_ln
   int 0x80; return to the kernel

   mov eax, 4; pass sys_write
   mov ebx, 1; stdout
   mov ecx, buffer; display the buffer contents
   mov edx, bf_sz; size of buffer
   int 0x80	 ; return to the kernel
   jmp end	 ; We are all finished

stdin:
; Get text from keyboard buffer
  mov eax, 3; pass sys_read
  xor ebx, 0; stdin
  mov ecx, buffer
  mov edx, bf_sz; count
  int 0x80	; return

  jmp stdout; Go to display function

end:
  ret



It segfaults once it's done. If you don't like it, fix it :)

#27 OliveOyl3471   User is offline

  • Everybody's crazy but me!
  • member icon

Reputation: 135
  • View blog
  • Posts: 6,581
  • Joined: 11-July 07

Re: "Hello DIC" in every programing language

Posted 07 April 2009 - 07:58 PM

View Postno2pencil, on 12 Mar, 2009 - 06:28 AM, said:

If you don't like it, fix it :)

If I could, I would. //I wish I was as smart as you! :)
What's with the grey text after the apostrophe? Does that mean it's commented out?

#28 Nikhil_07n   User is offline

  • The cheese stands alone..
  • member icon

Reputation: 54
  • View blog
  • Posts: 2,490
  • Joined: 09-January 09

Re: "Hello DIC" in every programing language

Posted 07 April 2009 - 10:06 PM

VB6

Dim Name as String
Dim strOutput as String

Name=Inputbox("Enter Name")

strOutput = "Hello " & Name & ", Welcome to Dream.In.Code"

Print strOutput



#29 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: "Hello DIC" in every programing language

Posted 07 April 2009 - 10:11 PM

View PostOliveOyl3471, on 7 Apr, 2009 - 08:58 PM, said:

What's with the grey text after the apostrophe? Does that mean it's commented out?

For some reason it's picking up a single quote in the word We're, & it never finds another. So the code blocks here think that's all in string. *shrug*

#30 firebolt   User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: "Hello DIC" in every programing language

Posted 07 April 2009 - 11:53 PM

EDIT: (program was too simple)

Will do another one.

This post has been edited by firebolt: 08 April 2009 - 12:49 AM


  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »