Page 27 of 30 FirstFirst ... 172526272829 ... LastLast
Results 261 to 270 of 297

Thread: "Hello Ubuntu" in every programming language

  1. #261
    Join Date
    Dec 2008
    Beans
    207

    Re: "Hello Ubuntu" in every programming language

    SIGI
    Code:
    aHp>aep>alp>alp>aop>a p>aUp>abp>aup>anp>atp>aup>*p

  2. #262
    Join Date
    Jan 2008
    Location
    Whenever the food is.
    Beans
    1,203
    Distro
    Kubuntu

    Re: "Hello Ubuntu" in every programming language

    Any known programming languages left? (no joke-languages)
    Keyboard not found!

    Press any key to continue...

  3. #263

    Re: "Hello Ubuntu" in every programming language

    This tread reminds me of whats happening on this site. Basically its the "99 bottles of beer" song written in loads of different programming languages. I think the author of the site is up to 1253 different languages. Maybe we could compare the lists of languages or something...
    Last edited by s.fox; February 28th, 2009 at 03:04 PM.
    Me on the web:

  4. #264
    Join Date
    Jun 2006
    Location
    Harbin, China
    Beans
    123
    Distro
    Ubuntu Studio 10.10 Maverick Meerkat

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by i_heart_pandas View Post
    policy based c++

    Code:
    #include <iostream>
    #include <string>
    #include <cstdlib>
    
    template<class LANG>
    struct hello_ubuntu : private LANG{
      static void run(std::istream& istr, std::ostream& ostr){
        ostr << LANG::intro();
        std::string name;
        istr >> name;
        ostr << LANG::outroa() << name << LANG::outrob() << std::endl;
      }
    };
    
    struct english{
      static std::string intro(){
        return "Hi! What's your name? ";
      }
      static std::string outroa(){
        return "Hello, ";
      }
      static std::string outrob(){
        return "! Welcome to Ubuntu!";
      }
    };
    
    int main(){
      hello_ubuntu<english>::run(std::cin,std::cout);
      std::exit(EXIT_SUCCESS);
    }
    Ahh! Thanks for reminding me why I don't like C++!
    Science is open source religion

  5. #265
    Join Date
    Aug 2007
    Beans
    949

    Re: "Hello Ubuntu" in every programming language

    Common Lisp

    Has this been done already? I don't see it on the main page.

    Code:
    (defun say-hello
     (format t "Hi! What's your name?")
     (setf name (read-line *query-io*))
     (format t "Hello, ~a! Welcome to Ubuntu!"))

  6. #266
    Join Date
    Jul 2008
    Beans
    1,706

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by maximinus_uk View Post
    Ahh! Thanks for reminding me why I don't like C++!
    thats not normal c++...what the heck is policy C++?

  7. #267
    Join Date
    Oct 2007
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by jimi_hendrix View Post
    thats not normal c++...what the heck is policy C++?
    http://en.wikipedia.org/wiki/Policy-based_design
    Spiralinear: Humanity & Machines
    RUNNING: Fedora | FreeBSD | Windows 7

  8. #268
    Join Date
    Dec 2008
    Beans
    207

    Re: "Hello Ubuntu" in every programming language

    SNOBOL


    Code:
       OUTPUT = "Hi! What's your name?" 
       NAME = INPUT
       OUTPUT = "Hello, "
    + NAME "! Welcome to Ubuntu!"
    END

  9. #269
    Join Date
    Jul 2007
    Beans
    93
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Thumbs up Re: "Hello Ubuntu" in every programming language

    Lol code

    PHP Code:
    hai
      can has stdio
    ?
      
    Visible "hai Ubuntu!"
    kthxbye 

  10. #270
    Join Date
    May 2009
    Beans
    5

    Re: "Hello Ubuntu" in every programming language

    AutoHotkey

    Code:
    InputBox, name, Hello Ubuntu, Please enter your name.
    MsgBox, Hello %name%! Welcome to Ubuntu!
    -----

    and more Java variations...

    Java 1.6 Swing

    Code:
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    
    public class HelloUbuntuSwing extends JFrame {
    
    	public JPanel panel;
    	public JLabel label;
    	public JTextField area;
    	public JButton go;
    	public JTextArea output;
    
    	public HelloUbuntuSwing() {
    		setTitle("Hello Ubuntu");
    		setPreferredSize(new Dimension(400, 300));
    		setDefaultCloseOperation(EXIT_ON_CLOSE);
    		panel = new JPanel();
    		setContentPane(panel);
    
    		init();
    		setLayout();
    		pack();
    		setLocationRelativeTo(null);
    		setVisible(true);
    	}
    
    	private void init() {
    		label = new JLabel("Hi! What's your name?");
    		area = new JTextField(10);
    		go = new JButton("Submit!");
    		go.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				String name = area.getText();
    				if(name.equals("")) JOptionPane.showMessageDialog(null, "Please enter your name.");
    				else {
    					String format = "Hello %s! Welcome to Ubuntu!";
    					output.setText(String.format(format, name));
    				}
    			}
    		});
    
    		output = new JTextArea();
    		output.setColumns(20);
    		output.setRows(3);
    	}
    
    	private void setLayout() {
    		add(label);
    		add(area);
    		add(go);
    		add(output);
    	}
    
    	public static void main(String[] args) {
    		new HelloUbuntuSwing();
    	}
    }
    Java 1.6 Using SwiXML GUI
    Code:
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    
    import org.swixml.SwingEngine;
    
    public class HelloUbuntu {
    	public JFrame frame;
    	public JTextField input;
    	public JButton go;
    	public JTextArea output;
    	
    	public HelloUbuntu() throws Exception {
    		new SwingEngine(this).render(new File("hello.xml"));
    		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		frame.pack();
    		frame.setResizable(false);
    		frame.setLocationRelativeTo(null);
    		frame.setVisible(true);
    		
    		go.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				String name = input.getText();
    				if(name.equals("")) JOptionPane.showMessageDialog(null, "Please enter your name.");
    				else {
    					String format = "Hello %s! Welcome to Ubuntu!";
    					output.setText(String.format(format, name));
    				}
    			}
    		});
    		
    		output.setLineWrap(true);
    		output.setWrapStyleWord(true);
    	}
    	public static void main(String[] args) throws Exception {
    		new HelloUbuntu();
    	}
    }
    "hello.xml"

    Code:
    <frame id='frame' title="Hello Ubuntu!">
    	<panel layout='GridLayout(1,2)'>
    		<panel layout='GridLayout(3,1)'>
    			<label>Hello! What's your name?</label>
    			<textfield id='input' columns="10"/>
    			<button id='go'>Submit!</button>
    		</panel>
    		<panel><textarea id='output' columns="12" rows="3"/></panel>
    	</panel>
    </frame>
    Last edited by DemiReticent; May 21st, 2009 at 08:03 AM.

Page 27 of 30 FirstFirst ... 172526272829 ... 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
  •