2010年1月13日 星期三

各種程式語言 Hello World 比較…

------------------------------------------------------------

>>> C

#include

main()
{
   printf ("Hello,World!\n");
}

------------------------------------------------------------


>>> C++

#include

int main()
{
   std::cout << "Hello,world!\n";
}

------------------------------------------------------------

>>> Fortran

PROGRAM HELLO
PRINT *,'Hello,World!'
END

------------------------------------------------------------

>>> Haskell

main = print("Hello,World!")

------------------------------------------------------------

>>> Java

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

------------------------------------------------------------

>>> JavaScript



------------------------------------------------------------

>>> Matlab

disp('Hello,World!')

------------------------------------------------------------

>>> Modula-2

MODULE HelloWorld;

FROM InOut IMPORT writestring, writeln;

begin
   WriteString("Hello,World!");
   Writeln;
end HelloWorld.

------------------------------------------------------------

>>> Pascal

program HelloWorld;

begin
   writeln('Hello,World!');
end.

------------------------------------------------------------

>>> Perl

print "Hello,World!\n";

------------------------------------------------------------

>>> Prolog

HelloWorld :-
printstring("Hello,World!").

------------------------------------------------------------

>>> QBasic

begin:
print "Hello,World!"

------------------------------------------------------------


>>> PYTHON

print 'Hello, World'

------------------------------------------------------------

沒有留言:

張貼留言