售前咨询
技术支持
渠道合作

各种语言版本的“Hello, world”程序汇总

“Hello, world”程序是指在计算机屏幕上输出“Hello,world”这行字符串的计算机程序,“hello, world”的中文意思是“世界,你好”。这个例程在Brian Kernighan 和Dennis M. Ritchie合著的《The C Programme Language》使用而广泛流行。

01、java语言:

public class HelloWorld

{

public static void main(String[] args)

{

System.out.println(“HelloWorld!”);

}

 

}

02、C语言:

#include <stdio.h>

int main()

{

printf(“hello world”);

return 0;

}

03、C++语言:

#include <stdafx.h>

#include <iostream>

using namespace std;

int main()

{

cout<<“hello world”<<endl;

return 0;

 

}

04、C#语言:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace HelloWorld

{

class Program

{

static void Main(string[] args)

{

Console.WriteLine(“Hello World!”);

Console.ReadLine();

}

}

}

05、VB语言:

Module MainFrm

Sub Main()

System.Console.WriteLine(“Hello, World!”)

End Sub

End Module

 

06、Swift:语言:

print(“Hello, World!”)

07、Go语言:

package main

 

import “fmt”

 

func main() {

fmt.Print(“Hello, World!”)

}

08、BATCH语言:

@echo off

echo Hello, World!

pause

09、PHP语言:

echo “Hello, World!”;

10、JavaScript

console.log(“Hello, World!”)

11、LaTeX语言:

\documentclass{article}

 

\begin{document}

Hello, World!

 

\end{document}

12、Mathematica语言:

方法一:基于Wolfram 底层语言(进入表达式界面使用)

Cell[“Hello, World!”]

方法二:直接使用数学输出函数

CellPrint[Cell[“Hello, World!”]]

13、Python 2语言:

print ‘Hello world’

14、Python 3语言:

print(“Hello, World!”)

15、Pascal语言:

begin

writeln(“Hello world”);

end.

16、html语言:

<html>

<body>

<p>

Hello world!

</p>

</body>

</html>

小编目前收集到以上几种语言的“Hello, world”程序,欢迎各位小伙伴们继续补充。


GDCA(数安时代)拥有国内自主签发信鉴易 TrustAUTH SSL证书以及是国际多家知名品牌:GlobalSign、Symantec、GeoTrust SSL证书指定的国内代理商。为了让国内更多的网站升级到安全的https加密传输协议,五一期间,GDCA推出多种国际知名SSL证书优惠活动,实现HTTPS加密并展示网站真实身份信息。详情请资讯GDCA产品官网在线客服https://www.sslsq.com/。

上一篇:

下一篇:

相关文章