----------------------------------------------------------------------
;汇编版(简化格式)
.model small
.data
hellomessage db 'Hello,world',13,10,'$'
.code
.startup
mov ax,@data
mov ds,ax
mov dx,offset hellomessage
mov ah,09h
int 21h
.exit
end
----------------------------------------------------------------------
;汇编版(简化段定义格式)
.model small
.data
hellomessage db 'Hello,world',13,10,'$'
.code
start:
mov ax,@data
mov ds,ax
mov dx,offset hellomessage
mov ah,09h
int 21h
mov ah,4ch
int 21h
end start
----------------------------------------------------------------------
;汇编版(显式段定义格式)
datas segment
string db 'Hello,world!',13,10,'$'
datas ends
codes segment
assume cs:codes,ds:datas
start:
mov ax,datas
mov ds,ax
lea dx,string
mov ah,09h
int 21h
mov ah,4ch
int 21h
codes ends
end start
----------------------------------------------------------------------
//C版
#include <stdio.h>
void main()
{
printf("Hello,world!");
}
----------------------------------------------------------------------
//C++版
#include <iostream>
using namespace std;
int main(void)
{
cout<<"Hello,world!"<<endl;
return 0;
}
----------------------------------------------------------------------
//JAVA版
public class HelloWorld
{
public static void main( String args[] )
{
System.out.println("Hello,world!");
}
}
----------------------------------------------------------------------
'ASP版
<%
response.write "Hello,world!"
%>
----------------------------------------------------------------------
//JSP版
<%
out.print("Hello,world!");
%>
----------------------------------------------------------------------
//PHP版
<?
php echo("Hello,world!");
?>
----------------------------------------------------------------------
#PERL版
#!/usr/bin/perl
print "Hello,world!";
----------------------------------------------------------------------