| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 592 人关注过本帖, 1 人收藏
标题:24种编程语言说“hello world”的区别?
只看楼主 加入收藏
cdhqyj
Rank: 1
等 级:禁止访问
帖 子:107
专家分:0
注 册:2020-2-28
结帖率:0
收藏(1)
 问题点数:0 回复次数:6 
24种编程语言说“hello world”的区别?
01. Python
print('Hello, world!')

02. C
#include <stdio.h>
int main() {
  printf("Hello, World!");
  return 0;
}

03. C++
#include <iostream>
int main() {
  std::cout << "Hello World!";
  return 0;
}

04. Java
class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}

05. C#

namespace HelloWorld
{
  class Hello {         
    static void Main(string[] args)
    {
      System.Console.WriteLine("Hello World!");
    }
  }
}

06. Visual Basic
Imports System
 
Module Module1
  Sub Main()
    Console.WriteLine("Hello World!")
    Console.WriteLine("Press Enter Key to Exit.")
    Console.ReadLine()
  End Sub
End Module

07. JavaScript

  console.log('Hello World');

08. SQL
CREATE TABLE helloworld (phrase TEXT);
INSERT INTO helloworld VALUES ("Hello, World!");
SELECT * FROM helloworld;

09. Assembly Language
global    _start
  
          section   .text
_start:   mov       rax, 1                  ; system call for write
          mov       rdi, 1                  ; file handle 1 is stdout
          mov       rsi, message            ; address of string to output
          mov       rdx, 13                 ; number of bytes
          syscall                           ; invoke operating system to do the write
          mov       rax, 60                 ; system call for exit
          xor       rdi, rdi                ; exit code 0
          syscall                           ; invoke operating system to exit
  
          section   .data
message:  db        "Hello, World", 10      ; note the newline at the end

10. PHP
<!DOCTYPE html>
<html>
<body>
  
<h1>My first PHP page</h1>
  
<?php
echo "Hello World!";
?>
  
</body>
</html>

11. Swift
print("Hello, world!")

12. Go
package main
  
import "fmt"
  
func main() {
    fmt.Println("hello world")
}

13. R
print("Hello World!")

14. Classic Visual Basic
Imports System
  
Module Module1
  Sub Main()
    Console.WriteLine("Hello World!")
    Console.WriteLine("Press Enter Key to Exit.")
    Console.ReadLine()
  End Sub
End Module

15. MATLAB
function y = hello_world
%#codegen
y = 'Hello World!';


16. Ruby
puts "Hello World"

17. Rust
fn main() {
  println!("Hello World!");
}

18. Scala
@main def hello() = println("Hello, World!")

19. Perl
#!/usr/bin/perl
use warnings;
print("Hello, World!\n");

20. Scratch
  say Hello World!

21. (Visual) FoxPro
Messagebox("Hello World!",64)
? "Hello World"

22. SAS
proc ds2 libs=work;
data _null_;
  
  /* init() - system method */
  method init();
    declare varchar(16) message; /* method (local) scope */
    message = 'Hello World!';
    put message;
  end;
enddata;
run;
quit;

23. Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSLog (@"Hello, World!");
    [pool drain];
    return YES;
  
}
搜索更多相关主题的帖子: main world Console System hello 
2023-03-09 14:37
阳光上的桥
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:38
帖 子:129
专家分:772
注 册:2023-1-12
收藏
得分:0 
24.LUA
print('Hello,World')
看起来和PYTHON一样
25.AHK
MsgBox,Hello`,World
2023-03-09 17:22
阳光上的桥
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:38
帖 子:129
专家分:772
注 册:2023-1-12
收藏
得分:0 
26. MASM x64 汇编
; 在 VS 下生成64位EXE文件的步骤
; ml64 /c hello.asm
; link /subsystem:windows /entry:main hello.obj

extern MessageBoxA:proc
includelib   user32.lib

NULL EQU 0
MB_OK EQU 0


.const
    msg   BYTE  "Hello x64 World!", 13, 10, 0
.CODE

    main PROC
        sub rsp,8
        sub rsp,20h
        mov rcx,NULL
        mov rdx,offset msg
        mov r8,offset msg
        mov r9d,MB_OK
        call MessageBoxA
        xor ecx, ecx        ; exit code = 0
        ret
    main ENDP

END
2023-03-10 08:36
pvm2000
Rank: 6Rank: 6
等 级:贵宾
威 望:24
帖 子:179
专家分:312
注 册:2022-12-22
收藏
得分:0 
2023-03-11 01:39
东海ECS
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:Python
等 级:版主
威 望:32
帖 子:412
专家分:1646
注 册:2023-1-24
收藏
得分:0 
共同学习

会当凌绝顶,一览众山小.
2023-03-11 08:24
东海ECS
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:Python
等 级:版主
威 望:32
帖 子:412
专家分:1646
注 册:2023-1-24
收藏
得分:0 
C#应该加个应用:
程序代码:

using System;
namespace HelloWorld
{
  class Hello {         
    static void Main(string[] args)
    {
      System.Console.WriteLine("Hello World!");
    }
  }
}



会当凌绝顶,一览众山小.
2023-03-11 08:26
sssooosss
Rank: 9Rank: 9Rank: 9
等 级:禁止访问
威 望:3
帖 子:664
专家分:1115
注 册:2019-8-27
收藏
得分:0 
共同进步
2023-03-18 11:08
快速回复:24种编程语言说“hello world”的区别?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016206 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved