Page 2 of 30 FirstFirst 123412 ... LastLast
Results 11 to 20 of 297

Thread: "Hello Ubuntu" in every programming language

  1. #11
    Join Date
    May 2007
    Location
    Sweden
    Beans
    84
    Distro
    Kubuntu 7.10 Gutsy Gibbon

    Re: "Hello Ubuntu" in every programming language

    Python

    Code:
    #!/usr/bin/env python
    
    if __name__ == "__main__":
        name = raw_input("Hi! What's your name? ")
        print "Hello, %s!  Welcome to Ubuntu!" % (name or "Nameless thing")

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

    Re: "Hello Ubuntu" in every programming language

    RUBY

    Code:
    print "What is your name?"
    your_name = gets()
    puts "hello"+your_name+"welcome to Ubuntu"

  3. #13
    Join Date
    May 2005
    Location
    Dallas, TX
    Beans
    116
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: "Hello Ubuntu" in every programming language

    TCL

    Code:
    #!/usr/bin/env tclsh
    puts -nonewline "Hi! What's your name? "
    flush stdout
    gets stdin name
    puts "Hello, $name! Welcome to Ubuntu!"

  4. #14
    Join Date
    Sep 2005
    Location
    Cedar Rapids, IA, USA
    Beans
    545
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: "Hello Ubuntu" in every programming language

    FORTRAN 77
    Code:
    PROGRAM HELLOUBUNTU
    C      VARIABLE DECLARATIONS
          CHARACTER(25) MYNAME
     
    C      GET USER INPUT (NAME)
          PRINT *, "HI! WHAT'S YOUR NAME?"
          READ *, MYNAME
     
    C      OUTPUT MESSAGE
           PRINT, "HELLO ", MYNAME, "! WELCOME TO UBUNTU!"
     
    END
    FORTRAN 90
    Code:
    PROGRAM HELLOUBUNTU
     
        ! VARIABLE DECLARATIONS
        CHARACTER(25) :: MYNAME
     
        WRITE(*,*) "HI, WHAT'S YOUR NAME?"
        READ(*,*) MYNAME
     
        WRITE(*,*) "HELLO ", TRIM(MYNAME), "! WELCOME TO UBUNTU!"
     
        ! END PROGRAM
        STOP
     
    END PROGRAM
    Last edited by xtacocorex; July 22nd, 2007 at 02:32 AM. Reason: Screwed up F77 write statements
    #399784 | Ubuntu User #287
    *** If you're going to program, install the damn build-essential package ***
    There is no such thing as Ubuntu specific programming
    Save the electrons - if you quote, trim!

  5. #15
    Join Date
    Jul 2005
    Location
    Ontario, Canada
    Beans
    366
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: "Hello Ubuntu" in every programming language

    Haskell

    Code:
    main :: IO ()
    main = do
        putStr "Hello. What's your name? "
        name <- getLine
        putStrLn $ "Welcome to Ubuntu, " ++ name ++ "."
    OCaml
    Code:
    let main () =
        print_string "Hello. What's your name? ";
        let name = read_line () in
        Printf.printf "Welcome to Ubuntu, %s\n." name
    
    let _ = main ()
    D
    Code:
    import
        tango.io.Console,
        tango.io.Stdout;
    
    char[] readName( char[] prompt="Hello. What's your name? " ) {
        Cout( prompt ).flush;
        
        char[] input;
        Cin.readln( input );
        return input;
    }
    
    void main() {
        Stdout.formatln( "Welcome to Ubuntu, {0}", readName() );
    }
    Last edited by Jessehk; July 10th, 2007 at 09:46 PM.

  6. #16
    Join Date
    Mar 2007
    Beans
    464

    Re: "Hello Ubuntu" in every programming language

    Basic
    Can't believe noone has done basic yet!
    Code:
    10 input "Hello!  What is your name?",name$
    20 print "Welcome to Ubuntu, "; name$

  7. #17
    Join Date
    Jun 2007
    Location
    VA, USA
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: "Hello Ubuntu" in every programming language

    C#
    Code:
    public class HelloUbuntu
    {
    	public static void Main()
    	{
    		System.Console.WriteLine("Hello! What is your name?");
    		string name = System.Console.ReadLine();
    		System.Console.WriteLine("Hello, {0}! Welcome to Ubuntu!", name);
    	}
    }
    Last edited by Occasionally Correct; July 10th, 2007 at 10:40 PM.

  8. #18
    Join Date
    Dec 2005
    Beans
    527
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: "Hello Ubuntu" in every programming language

    Objective C (more complicated than it has to be)
    Code:
    #include <Foundation/Foundation.h>
    #include <stdio.h>
    
    @interface User : NSObject
    {
        char *name;
        char *os;    
    }
    
    - (void) setOS: (char *) os;
    - (void) setUser: (char *) name;
    - (void) welcome;
    
    @end
    
    @implementation User
    
    - (void) setOS: (char *) osys
    {
        os = osys;
    }
    
    - (void) setUser: (char *) username
    {
        name = username;
    }
    
    - (void) welcome
    {
        printf ("Hello, %s! Welcome to %s\n", name, os);
    }
    
    @end
    
    int main ()
    {
        User *thedoc;
        char name[100];
        char *os;
        
        printf ("What is your name? ");
        fgets (name, 100, stdin);
        name[strlen(name) - 1] = '\0';
        
        os = "Ubuntu";
        thedoc = [User new];
            
        [thedoc setOS: os];
        [thedoc setUser: name];
        [thedoc welcome];
    }

  9. #19
    Join Date
    Jun 2006
    Location
    ~wfarr
    Beans
    409

    Re: "Hello Ubuntu" in every programming language

    Quote Originally Posted by derjames View Post
    RUBY

    Code:
    print "What is your name?"
    your_name = gets()
    puts "hello"+your_name+"welcome to Ubuntu"
    Ruby (Improved)

    Code:
    puts "What is your name?"
    name = gets.strip
    puts "Hello, #{name}! Welcome to Ubuntu!"

  10. #20

    Re: "Hello Ubuntu" in every programming language

    Pascal

    Code:
    program Ubuntu;
    
    var
    name : string;
    
    begin
        write('Whats your name?');
        readln(name);
        write(name, ',  welcome to Ubuntu!');
    end.

Page 2 of 30 FirstFirst 123412 ... 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
  •