I'll living just like this. Herobrine

Herobrine's life

Hello world——程序员的第一篇代码

Hello world 是和A+B问题并驾齐驱的一道题,也是当世的经典题之一。

题目:

    输出“Hello world”
    样例输入

    样例输出
    Hello world

Hello world 这道题嘛,

 


我怎么可能只讲最简单的做法呢?
前方高能
C++
    

 #include<isotream>
    using namespace std;
    int main(){
        cout<<"Hello world";
    }

 


    
C

   

#include <stdio.h>
    int main(void) {
        printf("Hello world");
        return 0;
    }

 



Go

  

 package main
    import "fmt"
    func main() {
        fmt.Printf("%s\n", "hello world")
    }

 



R

   

cat("hello world\n")

 



rust

  

 fn main() {
        println!("hello world");
    }

 


lisp

 

  *(format t "Hello World") 

 



D

  

 import std.stdio;
    void main()
    {
      writeln("hello world");
    }

 


perl

   

print "hello world\n";

 



python

  

 #!/usr/bin/python
    # -*- coding: utf-8 -*-
    import sys
    if True :
        print('Hello world')

 



nim

   

echo "hello world"

 


haskell

  

 main = putStrLn "hello world"

 



ruby
    
  

 puts "Hello world"    

 



scala

 

  println("hello world")

 



clojure

      

 (ns clojure.examples.hello
        (:gen-class))
    
    (defn hello-world [username]
    (println (format "Hello%s" username)))
    
    (hello-world "world")

 



groovy

    class Greet {
    def name
    Greet(who) { name = who[0].toUpperCase() +
                    who[1..-1] }
    def salute() { println "Hello world" }
    }
 
    g = new Greet('world')  // create object
    g.salute()

 



END

posted on 2019-06-09 14:42  herobrine  阅读(2222)  评论(0编辑  收藏  举报

导航