Page 8 of 30 FirstFirst ... 67891018 ... LastLast
Results 71 to 80 of 297

Thread: "Hello Ubuntu" in every programming language

  1. #71
    Join Date
    Apr 2006
    Beans
    996
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: "Hello Ubuntu" in every programming language

    Jass:

    Code:
    function HelloUbuntu_Read takes nothing returns nothing
          call BJDebugMsg("Hello "+GetEventPlayerChatString()+", welcome to Ubuntu")
    
          call DestroyTrigger(GetTriggeringTrigger())
    endfunction
    
    function HelloUbuntu_ini takes nothing returns nothing
     local trigger t=CreateTrigger()
          call TriggerAddAction(t, function HelloUbuntu_Read)
          call TriggerRegisterPlayerChatEvent(t, Player(0), "", false)
          call BJDebugMsg("Hi, what's your name?")
     set t=null
    endfunction
    vJass:


    Code:
    library HelloUbuntu initializer init
    
    private function onRead takes nothing returns nothing
          call BJDebugMsg("Hello "+GetEventPlayerChatString()+", welcome to Ubuntu")
    
          call DestroyTrigger(GetTriggeringTrigger())
    endfunction
    
    private function init takes nothing returns nothing
     local trigger t=CreateTrigger()
          call TriggerAddAction(t, function onRead)
          call TriggerRegisterPlayerChatEvent(t, Player(0), "", false)
          call BJDebugMsg("Hi, what's your name?")
     set t=null
    endfunction
    
    endlibrary
    Xye incredibly difficult puzzle game with minimal graphics. Also at playdeb
    Got a blog: Will Stay Free

  2. #72
    Join Date
    Mar 2006
    Location
    Sheffield, UK
    Beans
    322

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by bobbocanfly View Post
    Probably been done but

    LOLCODE

    Code:
    HAI
    CAN HAS STDIO?
    I HAS A FISH
    I HAS A WELCOME ITZ "HELLO" 
    I HAS A WELCOME2 ITZ ", WELCOME TO UBUNTU"
    GIMMEH FISH
    VISIBLE WELCOME
    VISIBLE FISH
    VISIBLE WELCOME2
    KTHXBYE
    Nedcode

    Code:
    ORITE
    GIES A VAR
    WHIT YOU SAYIN VAR
    HERE "HELLO".VAR."WELCOME TO UBUNTU"
    AFF


    I thought it was a joke... but no, it is not...

    http://lolcode.com/

    reading the documentation right now...

  3. #73
    Join Date
    Aug 2006
    Beans
    923
    Distro
    Kubuntu 8.04 Hardy Heron

    Re: "Hello Ubuntu" in every programming language

    Igor Pro
    (Wavemetrics programming language.)

    Code:
    #pragma rtGlobals=1
    
    Macro helloUbuntu()
    	execute "printHelloUbuntu()"
    end
    
    Function printHelloUbuntu()
    	String name
    	Prompt name, "Hi! What's your name? "
    	DoPrompt "Name Input", name
    	print "Hello, " + name + "! Welcome to Ubuntu!"
    End

  4. #74
    Join Date
    Aug 2006
    Beans
    72
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: "Hello Ubuntu" in every programming language

    Groovy

    Code:
    println "Hi! What's your name?"
    username = System.in.readLine()
    println "Hello, $username! Welcome to Ubuntu!"
    To those who don't know Groovy is like Java's cool young brother

    My first post btw, yay
    Last edited by tenmillionmilesaway; July 31st, 2007 at 09:49 PM.

  5. #75
    Join Date
    Aug 2006
    Beans
    72
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: "Hello Ubuntu" in every programming language

    Groovy via Swing

    Code:
    import groovy.swing.SwingBuilder
    import javax.swing.WindowConstants as WC
    
    swing = new SwingBuilder();
    frame = swing.frame(title:"Hello World Ubuntu", location:[100,100],
    		defaultCloseOperation:WC.EXIT_ON_CLOSE)
    	{
    	panel{
    		label(text:"Enter name")
    		textField(id:"message", columns:20)
    		button(text:"Hi!  What's your name?", actionPerformed:{
    			event -> swing.message.text = "Hello $swing.message.text!  Welcome to Ubuntu!"
    		})
    	}
    }
    frame.pack()
    frame.show()
    Groovy using its SwingBuilder to generate a JFrame

    For some reason it does not render correctly using compiz but i think that this is a known Java problem

  6. #76
    Join Date
    May 2006
    Beans
    35
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: "Hello Ubuntu" in every programming language

    Lua

    Code:
    print "Hello! What's your name?"
    local name = io.read("*line");
    print("Hello "..name.."! Welcome to Ubuntu!")

  7. #77
    Join Date
    Dec 2005
    Beans
    527
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: "Hello Ubuntu" in every programming language

    Groovy looks kinda cool.

  8. #78
    Join Date
    Apr 2007
    Beans
    83
    Distro
    Ubuntu 11.04 Natty Narwhal

    Wink Re: "Hello Ubuntu" in every programming language

    BASH
    Code:
    echo "Hello $USERNAME"
    Code:
    echo "Welcome to Ubuntu!"

  9. #79
    Join Date
    Aug 2005
    Location
    Birmingham, AL
    Beans
    974
    Distro
    Kubuntu

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by max.diems View Post
    C++

    Version 1: Do not write results to file


    Code:
    #include <cstdio>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    string username = "";
    
    int main(int argc, char *argv[]);
    
    int main(int argc, char *argv[]){
        cout << "Hi! What's your name? ";
        cin >> username;
        cout << "Hello, " << username << "! Welcome to Ubuntu!\n";
        return 0;
    }
    "Improved" C++ (WITH A CLASS!):

    Code:
    #include <iostream>
    #include <string>
    class Hello
    {
    	std::string name;
    
    	public:
    		void set_name();
    		std::string get_name();
    };
    
    void Hello::set_name()
    {
    	std::getline (std::cin, name);
    }
    std::string Hello::get_name()
    {
    	return name;
    }
    
    int main(void)
    {
    	Hello greet;
    	std::cout << "Hello, what's your name?" << std::endl;
    	greet.set_name();
    	std::cout << "Hi, " << greet.get_name() << "!  Welcome to Ubuntu." << std::endl;
    	return 0;
    }
    When you only have a hammer, everything looks like a nail, you know.
    Last edited by DoktorSeven; August 1st, 2007 at 07:02 AM.

  10. #80
    Join Date
    Mar 2007
    Location
    somewhere cold
    Beans
    70
    Distro
    Kubuntu 8.10 Intrepid Ibex

    Re: "Hello Ubuntu" in every programming language

    Curses (Python)

    Code:
    import curses, traceback, string
    
    screen = None
    
    def main(stdscr):
    	global screen
    	# add subscreen to main window
    	screen = stdscr.subwin(23, 79, 0, 0)
    	# draw box around subscreen
    	screen.box()
    	# draw keyhelp
    	screen.addstr(1, 15, "Type i to input, q to quit", curses.A_BOLD)
    	# add horizontal line
    	screen.hline(2, 1, curses.ACS_HLINE, 77)
    	# Draw prompt
    	screen.addstr(5, 4, "           Enter your name:", curses.A_BOLD)
    	
    
        # Enter loop
    	while 1==1:
    		c = screen.getch()
    		if c in (ord('q'), ord('Q')): break
    		if c in (ord('i'), ord('I')): 
    			curses.echo()
    			screen.addstr(5,33, " "*43, curses.A_UNDERLINE)
    			name = screen.getstr(5,33)
    			curses.noecho()
    			screen.addstr(10, 16, "Welcome to Ubuntu,", curses.A_NORMAL)
    			screen.addstr(10, 36, name, curses.A_BOLD)
    		screen.refresh()
    		continue
        
    
    
    
    if __name__=='__main__':
    	try:
    		# Initialization
    		stdscr=curses.initscr()
    		# echo off and key buffering off
    		curses.noecho() ; curses.cbreak()
    		# call main
    		main(stdscr)
    		# Set term defaults after loop broken
    		stdscr.keypad(0)
    		curses.echo() ; curses.nocbreak()
    		# Terminate curses
    		curses.endwin()
    	except:
    		# In the event of an error, restore the terminal
    		# to a sane state.
    		stdscr.keypad(0)
    		curses.echo() ; curses.nocbreak()
    		curses.endwin()
    		traceback.print_exc()           # Print the exception
    Copy to a file (ex: file.py) and run with:

    $ python file.py
    for beer in $(ls /home/fridge); do
    drink $beer
    done

Page 8 of 30 FirstFirst ... 67891018 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •