This is topic Hello World! in forum Books, Films, Food and Culture at Hatrack River Forum.


To visit this topic, use this URL:
http://www.hatrack.com/ubb/main/ultimatebb.php?ubb=get_topic;f=2;t=034519

Posted by Alcon (Member # 6645) on :
 
Lets post as many different variations of the 'hello world' program in as many different coding languages as we can. Just to give that little used 'code' button some exercise [Wink]

I'll go first: C++ (of course!)

code:
#include <iostream.h>

int main()
{
cout << "Hello world!\n";
return 0;
}


 
Posted by Clincher (Member # 7395) on :
 
VB.NET

Console App

code:
 
Module Module1

Sub Main()
Console.WriteLine("Hello World!")
End Sub

End Module

Windows App

code:
 
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MessageBox.Show("Hello World!")
End Sub
End Class



[ May 05, 2005, 02:24 AM: Message edited by: Clincher ]
 
Posted by Fitz (Member # 4803) on :
 
code:
 
<html>
<head><title>Hello World!</title></head>
<body>
Hello World!
</body>
</html>

HTML. Feel free to link a stylesheet and dandy up the "Hello World!"
 
Posted by ricree101 (Member # 7749) on :
 
How bout some C

code:
 
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}


 
Posted by Katarain (Member # 6659) on :
 
It's been so many years... let's see if I can get this right..

10 cls
20 print "Hello World!"
30 goto 20

We used to play around and make our old IBM XT without a harddrive play music and write in color. I forget all that.

[Big Grin]

What is that called, anyway... basic?

-Katarain
 
Posted by Xavier (Member # 405) on :
 
code:
public class HelloWorld{
public static void main(String[] args){
System.out.println("Hello World!");
}
}

Edit: its very hard to avoid the urge to hit tab after a line to indent it! Too much IDE's.

Oh and this is java of course.

[ May 05, 2005, 09:00 AM: Message edited by: Xavier ]
 
Posted by Xavier (Member # 405) on :
 
(DEFUN HELLO-WORLD () (PRINT (LIST 'HELLO 'WORLD)))

LISP. I miss this language...
 
Posted by Dagonee (Member # 5818) on :
 
Visual Basic For Applications (Word)

code:
Sub HelloWorld()
Dim doc As Word.Document
Set doc = Application.Documents.Add()
doc.Range().InsertAfter "Hello World"
End Sub

Edit: Even shorter version:

code:
Sub HelloWorld()
Application.Documents.Add().Range().InsertAfter "Hello World"
End Sub



[ May 05, 2005, 09:08 AM: Message edited by: Dagonee ]
 
Posted by narrativium (Member # 3230) on :
 
TI-86:

code:
:Disp "Hello world!"


 
Posted by Swampjedi (Member # 7374) on :
 
PHP, of course -

code:
<?php

echo 'Hello World!';

?>

Prolog -
code:
hello(D) :- 
write('hello world'),
New is D -1,
hello(New).

hello(0).


 
Posted by Xavier (Member # 405) on :
 
You know I listed LISP on my resume?

One of the engineers said I "had balls" to list that [Smile] . I got the job, so yay for LISP.
 
Posted by Swampjedi (Member # 7374) on :
 
PL/SQL -
code:
DECLARE
msg varchar(50);
BEGIN
Select text into msg from hello_tbl where world = 1;
END;
PRINT :msg;
.
run;


 
Posted by Tatiana (Member # 6776) on :
 
Can any other languages do infinite precision integer arithmetic? That's what's so cool about Lisp. It's great for doing number theory stuff, finding prime numbers and printing out every digit of 10,000 factorial or the first million digits of pi or things like that.

I'm about 10 years out of date in programming skillz, though, so likely there's something else way better now. But I just don't know what.

I bet I'm the only one here who's written code in IBM 370 JCL, or DEC PDP-11 machine language. Or how about PL/1? <laughs> A dubious distinction, at best.

My aunt helped write one of the first assemblers at Rand Corporation in the 50s before there were computer science majors (she majored in Math).

When I started my first programming job in 1982 I worked with a guy who had started out soldering boards in order to write his programs. They actually did that at one point, used a solder gun and little wires to write their code, then plugged the board into the slot to run the program. <boggles>
 
Posted by Hobbes (Member # 433) on :
 
XHTML (and XML I guess)

code:
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>Hello World</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>

Hobbes [Smile]
 
Posted by Hobbes (Member # 433) on :
 
Perl

code:
#! /usr/bin/perl

print "Content-type: text/html\n\n";
print <<'ending_print_tag';

<html>
<head>
<title>Hello World</title>
</head>
<body bgcolor = "black">
<p>
Hello World
</p>
</body>
</html>

ending_print_tag

Hobbes [Smile]
 
Posted by twinky (Member # 693) on :
 
Wow, ak, that's super-cool! [Cool]
 
Posted by Hobbes (Member # 433) on :
 
Ohh. Adam already did Perl, I didn't see that. [Embarrassed] Well ... mines longer. [Cool]

Hobbes [Smile]
 
Posted by Hobbes (Member # 433) on :
 
And on that note, I'm doing my own C++ one. [Smile]

code:
#include <iostream.h>

int main (int argc, char **argv)
{
cout << "Hello World" << endl;
return 0;
}

Hobbes [Smile]
 
Posted by Hobbes (Member # 433) on :
 
code:
#include <iostream.h>
#include "HatrackClasses.h"

int main (int argc, char **argv)
{
Hatracker aka ("aka");
Hatracker Tatiana ("Tatiana");
if (aka == Tatiana) {
cout << "They're the same" << endl;
} else {
cout << "They're not the same" << endl;
}

return 0;
}
/*
------
Output:
They're the same
*/

Hobbes [Smile]
 
Posted by Jay (Member # 5786) on :
 
with Ada.Text_IO;

procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, world!");
end Hello;

Ahhh... Ada. Barf. It's what we used in my into CS class. Good ol Dr. Atkins. I guess WVU had some kind of deal with the military to teach ada. Dr. Atkins was a great teacher. Hard as heck tests. But after his class every other CS class was a review.
 
Posted by Hobbes (Member # 433) on :
 
code:
#include <iostream.h>
#include "HatrackClasses.h"
int main (int argc, char **argv)
{
Hatracker adam613 ("adam613")
cout << adam613.getProperties () << endl;
return 0;
}
/*
------
Output:
Do-do head
*/

Hobbes [Smile]
 
Posted by The Pixiest (Member # 1863) on :
 
SOL

: Main
"Hello world" write
;
 
Posted by Dan_raven (Member # 3383) on :
 
Remind me to nominate this as the "Geekiest Thread Of The Year"
 
Posted by fugu13 (Member # 2859) on :
 
Many modern languages allow arbitrary precision arithmetic. Python, Ruby, Perl, all do it effortlessly (actually, never tried in Perl, but I'm pretty sure it can). Java can do it without much trouble.
 
Posted by Portabello (Member # 7710) on :
 
The ever-simple python:
code:
 print "howdy, y'all!" 


 
Posted by Jutsa Notha Name (Member # 4485) on :
 
Applescript:
code:
on run
display dialog ("Hello, World!" as text) buttons {"OK"}
end run

Cobol:
code:
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLO.
000300
000400*
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
100500 DISPLAY "Hello world!" LINE 15 POSITION 10.
100600 STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800 EXIT.

Assembly:
code:
title   Hello World Program                             (helloworld.asm)
dosseg
.model small
.stack 100h
.data
hello_message db 'Hello, World!',0dh,0ah,'$'
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
mov dx,offset hello_message
int 21h
mov ax,4C00h
int 21h
main endp
end main


 
Posted by Gregg (Member # 6752) on :
 
The C++ ones are just a tad C dependent. Here is another variation:

code:
#include <iostream>
using namspace std;

int main()
{
cout << "Hello world!" << endl;
return 0;
}



[ May 05, 2005, 12:07 PM: Message edited by: Gregg ]
 
Posted by fugu13 (Member # 2859) on :
 
Well, yes, pretty much any computer language we're discussing is Turing complete, and can thus calculate in arbitrary precision arithmetic in some way/shape/form. The ones I listed make it easy, though [Wink] .
 
Posted by dabbler (Member # 6443) on :
 
Shell Script:

code:
#!/bin/sh

echo "Hello, World"

[Smile]
 
Posted by solo (Member # 3148) on :
 
AML (Arc Macro Language)

code:
&type Hello World!


 
Posted by twinky (Member # 693) on :
 
Is that Brainf(@#%$ or whatever it's called?
 
Posted by DavidR (Member # 7473) on :
 
Mathematica:
code:
Mathematica 5.1 for Linux
Copyright 1988-2004 Wolfram Research, Inc.
-- Motif graphics initialized --

In[1]:= hw = "Hello, World!";

In[2]:= hw

Out[2]= Hello, World!

In[3]:= Quit

PASCAL:
code:
program helloworld

begin
writeln('Hello, World!')
end

FORTRAN:
code:
program helloworld
print*, "Hello World!"
end program helloworld


 
Posted by DavidR (Member # 7473) on :
 
LaTeX:
code:
\documentclass{article}
\begin{document}
Hello, World!
\end{document}



[ May 05, 2005, 02:52 PM: Message edited by: DavidR ]
 


Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2