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"
echo
a
|
A sample of Python code:
1
2
3
4
|
# -*- coding: utf-8 -*-
import
sys
a
=
"Hello World"
print
a
|
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"
>
function
sayHelloWorld() {
alert(
"Hello World"
);
}
</script>
|
A sample of C code:
1
2
3
4
5
6
|
#include <stdio.h>
int
main (
int
argc,
char
**argv)
{
printf
(
"Hello World!"
);
return
1;
}
|
A sample of C++ code:
1
2
3
4
5
6
|
#include <iostream>
using
namespace
std;
int
main (
int
argc,
char
**argv)
{
std::cout<<
"Hello World"
<<std::end1;
}
|
A sample of Obj-C code:
1
2
3
4
5
|
#import <Foundation/Foundation.h>
int
main (
int
argc,
char
**argv)
{
NSLog(@
"Hello World"
);
}
|
A sample of Java code:
1
2
3
4
5
|
public
class
HelloWorld {
public
static
void
main(String args[]) {
System.out.println(
"Hello World"
);
}
}
|