Go
Brand new language from Google
Code:package main import "fmt" func main() { fmt.Printf("Hello, Ubuntu\n"); }
Go
Brand new language from Google
Code:package main import "fmt" func main() { fmt.Printf("Hello, Ubuntu\n"); }
Prolog
PHP Code:
main :-
write('What is your name: '),
read(Name),
write('Hello '),
write(Name).
Go
Brand new language from Google
Edit:
I improved it and got bufio working!
PHP Code:
package main
import (
"fmt"
"os"
"bufio"
)
func main() {
fmt.Printf("Hi! What's your name? ")
reader := bufio.NewReader(os.Stdin)
input, _ := reader.ReadString('\n')
input = input[0:len(input)-1]
fmt.Print("Hello, ", input, "! Welcome to Ubuntu!\n")
}
As you can see (from the commented lines), I was going to use a bufio reader, but it kept including the newline on the input.(Edit: Since I got it working, I removed the comment lines. Now you can not see my attempt to make it work above) I eventually just went for a scanner (which I just happened to find on the internet). Also, yes, I did steal the header from above.Code:package main import ( "fmt" "os" "scanner" ) func main() { fmt.Printf("Hi! What's your name? ") var s scanner.Scanner s.Init(os.Stdin) input := s.Scan() scanner.TokenString(input) fmt.Print("Hello, ", s.TokenText(), "! Welcome to Ubuntu!\n") }
Edit: Moving better entry to top.
Last edited by patrickaupperle; June 11th, 2010 at 04:22 AM.
I didn't see the code written in C-shell derivatives, so here we go.
C Shell
Code:#!/bin/csh echo "Hi What's your name ?" set line = $< echo "Hello $line. Welcome to Ubuntu"Code:TPX30:~/tmp> ./x Hi What's your name ? C-Shell Hello C-Shell. Welcome to Ubuntu
Last edited by lostinxlation; April 3rd, 2010 at 10:46 AM.
Linoleum
Originally Posted by Cryoburner
Python
Obviously there have been several of these, but here's one in 3.1. It's written in a "pure OOP" style, obviously...
Code:class hello_ubuntu: def main(): name = input("Hi! What's your name? \n") print("Hello, {0}! Welcome to Ubuntu!".format(name)) hello_ubuntu.main()
Windows Vista-- $70
Professional virus scanner-- $120
Ditching that expensive malware box for Ubuntu-- priceless!
nice post!! hope to see more programs in many languages!!
MS-DOS version for A86 assembler
Adding in "segment overrides" and related bloat for other assemblers is left as an exercise for the reader. And yes, I've heard of people using TASM under Wine.Code:mov ah,9 mov dx,offset message int 21h mov ax,4c00h int 21h message db 'Hello Ubuntu!',0dh,0ah,'$'
Last edited by lisati; April 8th, 2010 at 05:07 AM. Reason: It's not a "Hello World" program! :)
Forum DOs and DON'Ts
Please use CODE tags
Including your email address in a post is not recommended
My Blog
Sporkl:
Code:print("Hi! What's your name? "); input txt_inp = print_input_field(10,20,""); print_input_button("Enter"); load_user_input(); print("Hello, " + get_input_value(txt_inp) + "! Welcome to Ubuntu!\n");
Bookmarks