Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (4)

Powered by Vanilla. Made with Bootstrap.
The "Hello, World!" thread
  • sangf
    Posts: 203
    just a fun idea, post your version of a "Hello, World!" program here. it can be as simple, creative, or esoteric as you like~

    i'll start by getting the sarcasm out of the way:

    English language:
    \"Hello, World!\"
  • Sh3llc0d3
    Posts: 1,910
    I'm tired lol... are we posting "hello world" in whatever language we want?



    I'm gonn guess so :P

    #!/usr/bin/perl
    print \"Hello, World!\n\";
  • sangf
    Posts: 203
    yes, any language is fine, though it's helpful to mention what it is.. it's nothing too serious though :P

  • #!/usr/bin/python
    print \"Hello, world!\"

    C:

    #include <stdio.h>
    int main()
    {
    printf(\"Hello, world!\n\");
    return 0;
    }
  • Sh3llc0d3
    Posts: 1,910
    #include <iostream>

    main()
    {
    std::cout << \"Hello, World!\n\";
    return 0;
    }
  • sangf
    Posts: 203
    Reverse in Python:

    #! /usr/bin/env python
    print('!dlroW ,olleH' [::-1])
  • Sh3llc0d3
    Posts: 1,910
    .data

    hello: .string \"Hello, World!\"

    .global_start

    _start:
    movl $4, %eax
    movl $1, %ebx
    movl $hello, %ecx
    int $0x80

    movl $1, %eax
    int $0x80


    Hows that for memory :P

    EDIT:
    [spoiler=fully commented and though-out code :P]
    .data		#data segment

    hello: #hello variable

    .ascii \"Hello, World!\n\" #ascii string

    .text #text segment
    .global _start #marks start point of program

    _start: #start of program

    movl $4, %eax #write
    movl $1, %ebx #output
    movl $hello, %ecx #pointer to variable hello
    movl $13, %edx #gives length of variable (hello)
    int $0x80 #initialise: prints variable

    movl $1, %eax #sys call: exit
    movl $0, %ebx #exit code
    int $0x80 #initialise: exit program
    [/spoiler]
  • sangf
    Posts: 203
    haha nice if you didn't reference that -> just forgot a couple of things (.ascii instead of .string? .text, .globl _start, the string length parameter, and exit status parameter (0) :P). you should label it too~
  • Sh3llc0d3
    Posts: 1,910
    I knew you'd pull me up on something :P lol. Personal bad habit is not commenting code... usually do it to avoid people understanding it, makes it less easy to leech :)

    What did I miss... I did it in windows as I couldn't be bothered to boot up virtualbox lol
  • Xin
    Posts: 3,251
    lolcode:

     HAI
    CAN HAS STDIO?
    VISIBLE \"HAI WURLD!\"
    KTHXBYE
    Xin
  • undead
    Posts: 822
    nooo xinapse i wanted to post hello world at lolcode :'(