About this site

来源:互联网 发布:如何创建app软件 编辑:程序博客网 时间:2024/05/07 19:07

In here we will discuss some program language,like the server script language PHP,shell,Python,Ruby and so on.In addition to this like the browser script language  javascript,and the compile language C,C++,Obj-C,Java and so on.Perhaps it has many errors,but I want you can find it and tell us.Thanks.

Below is some code segments which was wrote by the top main language in the internet.All the segment’s result is output a string “Hello World” in one line.

A sample of PHP code:

1
2
3
4
<?php
  $a= 'Hello World';
  echo$a;
?>

A sample of Shell code:

1
2
3
#!/bin/sh
a = "Hello World"
echoa

A sample of Python code:

1
2
3
4
# -*- coding: utf-8 -*-
importsys
a="Hello World"
printa

A sample of Ruby code:

1
2
a = "Hello World"
puts a

A sample of JavaScript code:

1
2
3
4
5
<script type="text/javascript">
  functionsayHelloWorld() {
    alert("Hello World");
  }
</script>

A sample of C code:

1
2
3
4
5
6
#include <stdio.h>
intmain (intargc, char**argv)
{
  printf("Hello World!");
  return1;
}

A sample of C++ code:

1
2
3
4
5
6
#include <iostream>
usingnamespace std;
intmain (intargc, char**argv)
{
  std::cout<<"Hello World"<<std::end1;
}

A sample of Obj-C code:

1
2
3
4
5
#import <Foundation/Foundation.h>
intmain (intargc, char**argv)
{
  NSLog(@"Hello World");
}

A sample of Java code:

1
2
3
4
5
publicclass HelloWorld {
  publicstatic void main(String args[]) {
    System.out.println("Hello World");
  }
}
原创粉丝点击