zoukankan      html  css  js  c++  java
  • 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
    ", "hello world")
        }



    R

       

    cat("hello world
    ")



    rust

      

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


    lisp

     

      *(format t "Hello World") 



    D

      

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


    perl

       

    print "hello world
    ";



    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

  • 相关阅读:
    深入理解link和@import到底有什么区别?
    你应该知道的简单易用的CSS技巧
    META标签的设置
    前端webp图片
    PAT 1130 Infix Expression[难][dfs]
    PAT 1118 Birds in Forest [一般]
    生信-cufflinks输入输出文件分析
    PAT 1121 Damn Single[简单]
    PAT 1049 Counting Ones [难]
    NGS中的一些软件功能介绍
  • 原文地址:https://www.cnblogs.com/herobrine-life/p/10993474.html
Copyright © 2011-2022 走看看