Quando você inicia em uma linguagem, você sempre digita (ou até mesmo a apostila de aprendizado pede essa tarefa) um código para o programa exibir a seguimte frase: Hello World! (ou algo parecido).
A seguir, confira em diversas linguagens, o código para exibir "Olá Mundo!"(Hello World):
OBS: Parte gráfica não incluída!
Em ActionScript-Flash 5: trace ("Hello World!");
Em Amiga-E: PROC main() IS WriteF('Hello World\n')
Em ASP com JavaScript:
<%@ language="javascript" %>
<html><body>
<%
Response.Write('Hello World!');
%>
</body></html>
Em Assembler-Z80-Console:
(OBS: Incluí código e comentários em inglês, que são marcados por
; This is "Hello World" program for Z80 and TMS9918 / TMS9928 / TMS9929 /
; V9938 or V9958 VDP
; That means, that this should work on SVI, MSX, Colecovision, Memotech,
; TI-99 and many other
; Z80 based home computers or game consoles.
;
; Because we don't know what system is used, we don't know where RAM
; is, so we can't use stack
; in this program.
;
; This version of Hello World was written by Timo "NYYRIKKI" Soilamaa
Pergunta
Denis Bittencourt Muniz
Olá galera!
Quando você inicia em uma linguagem, você sempre digita (ou até mesmo a apostila de aprendizado pede essa tarefa) um código para o programa exibir a seguimte frase: Hello World! (ou algo parecido).
A seguir, confira em diversas linguagens, o código para exibir "Olá Mundo!"(Hello World):
OBS: Parte gráfica não incluída!
Em ActionScript-Flash 5: trace ("Hello World!");
Em Amiga-E: PROC main() IS WriteF('Hello World\n')
Em ASP com JavaScript:
<%@ language="javascript" %>
<html><body>
<%
Response.Write('Hello World!');
%>
</body></html>
Em Assembler-Z80-Console:
(OBS: Incluí código e comentários em inglês, que são marcados por
; This is "Hello World" program for Z80 and TMS9918 / TMS9928 / TMS9929 /
; V9938 or V9958 VDP
; That means, that this should work on SVI, MSX, Colecovision, Memotech,
; TI-99 and many other
; Z80 based home computers or game consoles.
;
; Because we don't know what system is used, we don't know where RAM
; is, so we can't use stack
; in this program.
;
; This version of Hello World was written by Timo "NYYRIKKI" Soilamaa
; 17.10.2001
;
;----------------------------------------------------------------------
; Configure this part:
DATAP: EQU #98 ; VDP Data port #98 works on all MSX models
; (TMS9918/TMS9929/V9938 or V9958)
; #80 works on SVI
; (for other platforms you have to figure this out by your self)
CMDP: EQU #99 ; VDP Command port #99 works on all MSX models
; (TMS9918/TMS9929/V9938 or V9958)
; #81 works on SVI
; (for other platforms you have to figure this out by your self)
;-----------------------------------------------------------------------
; Program starts here:
ORG 0 ; Z80 starts always from here when power is turned on
DI ; We don't know, how interrupts works in this system, so we disable them.
; Let's set VDP write address to #0000
XOR A
OUT (CMDP),A
LD A,#40
OUT (CMDP),A
; Now let's clear first 16Kb of VDP memory
LD B,0
LD HL,#3FFF
LD C,DATAP
CLEAR:
OUT ©,B
DEC HL
LD A,H
OR L
NOP ; Let's wait 8 clock cycles just in case VDP is not quick enough.
NOP
JR NZ,CLEAR
; Now it is time to set up VDP registers:
;----------------------------------------
; Register 0 to #0
;
; Set mode selection bit M3 (maybe also M4 & M5) to zero and
; disable external video & horizontal interrupt
LD C,CMDP
LD E,#80
OUT ©,A
OUT ©,E
;----------------------------------------
; Register 1 to #50
;
; Select 40 column mode, enable screen and disable vertical interrupt
LD A,#50
INC E
OUT ©,A
OUT ©,E
;----------------------------------------
; Register 2 to #0
;
; Set pattern name table to #0000
XOR A
INC E
OUT ©,A
OUT ©,E
;----------------------------------------
; Register 3 is ignored as 40 column mode does not need color table
;
INC E
;----------------------------------------
; Register 4 to #1
; Set pattern generator table to #800
INC A
INC E
OUT ©,A
OUT ©,E
;----------------------------------------
; Registers 5 (Sprite attribute) & 6 (Sprite pattern) are ignored
; as 40 column mode does not have sprites
INC E
INC E
;----------------------------------------
; Register 7 to #F0
; Set colors to white on black
LD A,#F0
INC E
OUT ©,A
OUT ©,E
;----------------------------------------
; Let's set VDP write address to #808 so, that we can write
; character set to memory
; (No need to write SPACE it is clear char already)
LD A,8
OUT ©,A
LD A,#48
OUT ©,A
; Let's copy character set
LD HL,CHARS
LD B, CHARS_END-CHARS
COPYCHARS:
LD A,(HL)
OUT (DATAP),A
INC HL
NOP ; Let's wait 8 clock cycles just in case VDP is not quick enough.
NOP
DJNZ COPYCHARS
; Let's set write address to start of name table
XOR A
OUT ©,A
LD A,#40
OUT ©,A
; Let's put characters to screen
LD HL,ORDER
LD B,ORDER_END-ORDER
COPYORDER:
LD A,(HL)
OUT (DATAP),A
INC HL
JR OVERNMI
NOP
NOP
; Here is address #66, that is entry for NMI
RETN ;Return from NMI
OVERNMI:
DJNZ COPYORDER
; The end
HALT
; Character set:
; --------------
ORDER:
DEFB 1,2,3,3,4,0,5,4,6,3,7
ORDER_END:
CHARS:
; H
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %11111000
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %00000000
; e
DEFB %00000000
DEFB %00000000
DEFB %01110000
DEFB %10001000
DEFB %11111000
DEFB %10000000
DEFB %01110000
DEFB %00000000
; l
DEFB %01100000
DEFB %00100000
DEFB %00100000
DEFB %00100000
DEFB %00100000
DEFB %00100000
DEFB %01110000
DEFB %00000000
; o
DEFB %00000000
DEFB %00000000
DEFB %01110000
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %01110000
DEFB %00000000
; W
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %10101000
DEFB %10101000
DEFB %11011000
DEFB %10001000
DEFB %00000000
; r
DEFB %00000000
DEFB %00000000
DEFB %10110000
DEFB %11001000
DEFB %10000000
DEFB %10000000
DEFB %10000000
DEFB %00000000
; d
DEFB %00001000
DEFB %00001000
DEFB %01101000
DEFB %10011000
DEFB %10001000
DEFB %10011000
DEFB %01101000
DEFB %00000000
chars_end:
Em awk:
BEGIN {
print "Hello World!"
exit
}
Em bc: print "Hello World!\n"
Em C:
#include <studio.h>
void main() {
printf("Olá, mundo!\n");
}
Em C++:
#include <iostream.h>
main()
{
cout << "Hello World!" << endl;
return 0;
}
Em Clipper: @ "Hello World"
Em D:
void main()
{
printf("Hello World!\n");
}
Em Elan: putline ("Hello World!");
Em Euphoria:
procedure Hello()
print ("Hello World!")
end procedure
Em Frink: println["Hello World!"]
Em HTML:
<HTML>
<HEAD>
<TITLE>Hello World!</TITLE>
</HEAD>
<BODY>
Hello World!
</BODY>
</HTML>
Em ici: printf("Hello World!\n");
Em Icon:
procedure main()
write("Hello world")
end
Em Informix-4GL:
MAIN
DISPLAY "Hello World"
END MAIN
Em InstallScript:
program
MessageBox("Hello World!",INFORMATION);
endprogram
Em Java:
class HelloWorld {
static public void main( String args[] ) {
System.out.println( "Hello World!" );
}
}
Em JSP (Java Server Pages):
<%@ page language='java' %>
<%="Hello World!" %>
Em JavaScript:
<html>
<body>
<script language="JavaScript" type="text/javascript">
document.write('Hello World');
</script>
</body>
</html>
Em Lingo:
on startmovie
alert "Hello World"
end
Em Logo: DRUCKEZEILE [Hello World!]
Em Lua: print "Hello world"
Em Octave:
printf("Hello World\n");
Em OpenVMS: $ write sys$output "Hello World"
Em Pascal:
program HelloWorld;
begin
WriteLn('Hello World!');
end.
Em PHP:
<?php
echo 'Hello World!';
?>
Em Pike:
int main(){
write("Hello World!\n");
}
Em Profan:
cls
print "Hello World!"
waitkey
Em PureBasic-Console:
OpenConsole()
ConsoleTitle ("Hello World!")
PrintN ("Hello World!")
CloseConsole()
Em Rebol-view:
rebol[]
view layout[
text "Hello World!"
]
Em Rexx: SAY "Hello World!"
Em Ruby: STDOUT << "Hello World!"
Em Sather:
class HELLO is
main is #OUT + "Hello World!\n" end
end
Em SeneseTalk: on run put "Hello World!" end run
Em ShellScript: echo "Hello World!"
Em Simula:
BEGIN
OutText("Hello World!");
OutImage;
END
Em SML: fun hello() = output(std_out, "Hello World!");
Em Snobol: OUTPUT = "Hello World!"
Em Vatical:
LITURGY:
PRAY "Hello World!"
AMEN.
Em Visual Basic: MsgBox("Hello World!")
Em VMS: $ WRITE SYS$OUTPUT "Hello World!"
e por último:
Em ColdFusion:
<html>
<head>
<title>Hello World</title>
</head>
<body>
<cfset comprimento = 'Hello World'>
<cfoutput>
#comprimento#
</cfoutput>
</body>
</html>
Fonte: http://www.roesler-ac.de/wolfram/hello.htm
Até apróxima galera!
Link para o comentário
Compartilhar em outros sites
15 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.