|
许多编程语言的教科书中,都是通过介绍Hello-world程序来向读者展示出第一个程序示例作为开场白。我搜集了一些语言的该程序代码示例但未经编译运行,在这里仅作为展示比较。你更喜欢哪一种呢?我更喜欢G(LabVIEW也称为:G语言——图形化语言)。
C程序代码:
# include<stdio.h>
int main ()
{
Printf (“Hello , World! \n”);
Return 0;
}
C++程序代码:
# include
<iostream>
Int main()
{
Std::cout<<’Hello , World !\n’;
return 0;
}
C# 程序代码:
class ConsoleHelloWorld
{
public static void main ()
{
System.Console.WriteLine(“Hello , World !”)
;
}
}
JAVA程序代码
public class
HelloWorldCommandLine{
public static vold main (String[ ] args){
System.out.printLn(“Hello,World!”);
}
}
Windows程序代码:
# include
<windows.h>
Int WINAPI WinMain
(HINSTANCE hinstance,HINSTANCE hPrevlnstance,
PSTR szCmdLine,int iCmdShow)
{
MessageBox(NULL,TEXT(“Hello, World !”),TEXT(“HelloMsg”,0);
returm 0;
}
VB程序代码:
Dim ny As Integer
Private Sub Form_Load ()
Ny=0
Text1.Text=”Hello
, World !”
Text1.ForeColor=RGB(255,0,0)
End Sub
LabVIEW程序代码:
GMT+8, 2024-11-28 16:09 , Processed in 0.045824 second(s), 17 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.