Hello World: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
= Bash = | = Bash = | ||
| Line 36: | Line 33: | ||
$ g++ HelloWorld.cc -o hello.x | $ g++ HelloWorld.cc -o hello.x | ||
$ ./hello.x | $ ./hello.x | ||
</syntaxhighlight> | |||
= PHP = | |||
HelloWorld.php | |||
<syntaxhighlight lang="php"> | |||
<html> | |||
<body> | |||
<?php | |||
echo "Hello world!"; | |||
?> | |||
</body> | |||
</html> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 07:01, 5 October 2010
Bash
HelloWorld.sh:
#!bin/sh
echo "Hello world!"
To run it:
$ chmod +x HelloWorld.sh
$ ./HelloWorld.sh
C++
HelloWorld.cc:
#include <iostream>
int main()
{
std::cout << "Hello, world! This is C++.\n";
}
To run it:
$ g++ HelloWorld.cc -o hello.x
$ ./hello.x
PHP
HelloWorld.php
<html>
<body>
<?php
echo "Hello world!";
?>
</body>
</html>
Python
HelloWorld.py:
print "Hello, World!"
To run it:
$ python HelloWorld.py
Alternatively:
$ python -c "print 'Hello World! \n'"