各种编程语言的”HelloWorld!”程序

Listed below are example programs that print "hello world", written in the following languages:
[ C | C++ | D | Haskell | Lua | OCaml | PHP | Perl | Python | Ruby | Scheme | Tcl ]

C:

pasted 23 minutes ago:

int main(void){
 printf("%s/n","Hello World!");
 return 0;
}

view (4 lines, 1 line of output)

pasted 39 minutes ago:

#include
 
 
  
  
int main()
{
printf("Hello World!");
return 0;
}

 
 

view (6 lines, 1 line of output)

C++:

pasted 38 minutes ago:

#include
 
 
  
  
using namespace std;
int main()
{  
    std::ostream* fp; 
    fp = &std::cout ;
    fp->flush();
    *fp << "Hello world!" << std::endl; 
    return 0;
}

 
 

view (10 lines, 1 line of output)

pasted 1 hour ago:

#include 
 
 
  
  
using namespace std;

int main() {
  cout << "Hello, World!" << endl;
  return EXIT_SUCCESS;
}

 
 

view (7 lines, 1 line of output)

D:

pasted on Dec 13:

void main() {
printf("Hello World!/n");
}

view (3 lines, 1 line of output)

pasted on Dec 2:

void main() {
printf("Hello World!/n");
}

view (3 lines, 1 line of output)

Haskell:

pasted yesterday:

 
module Main where
    main :: IO ()
    main = putStrLn "Hello, World!/n"

view (3 lines, 2 lines of output)

pasted yesterday:

main=putStr"hello world"

view (1 line, 1 line of output)

Lua:

pasted yesterday:

print("Hello world")

view (1 line, 1 line of output)

pasted on Dec 19:

print "hello world"

view (1 line, 1 line of output)

OCaml:

pasted yesterday:

print_string"hello world"

view (1 line, 1 line of output)

pasted yesterday:

(fun x -> (fun x -> fun y -> fun z -> x (y z)) print_string (fun x -> x ^ "!") x) "Hello world"

view (1 line, 1 line of output)

PHP:

pasted yesterday:

 
 

view (3 lines, 1 line of output)

pasted yesterday:

 
 

view (3 lines, 1 line of output)

Perl:

pasted yesterday:

print "hello world/n";

view (1 line, 1 line of output)

pasted yesterday:

print 'Hello world';

view (1 line, 1 line of output)

Python:

pasted 55 minutes ago:

print("Hello World")

view (1 line, 1 line of output)

pasted yesterday:

print"hello world"

view (1 line, 1 line of output)

Ruby:

pasted on Dec 16:

puts "Hello World"

view (1 line, 1 line of output)

pasted on Dec 15:

print "Hello world!/n"

view (1 line, 1 line of output)

Scheme:

pasted yesterday:

(eval (quote (eval (quote (eval (quote (eval (quote (eval (quote (eval (quote (display "Hello world!")))))))))))))

view (1 line, 1 line of output)

pasted yesterday:

(eval (quote (eval (quote (eval (quote (eval (quote (eval (quote (eval (quote (display "Hello world!")))))))))))))

view (1 line, 1 line of output)

Tcl:

pasted on Dec 10:

puts -nonewline "Hello world!"

view (1 line, 1 line of output)

pasted on Dec 6:

puts -nonewline "Hello world!"

view (1 line, 1 line of output)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值