Hello World: Difference between revisions
From charlesreid1
(→C++) |
No edit summary |
||
| Line 15: | Line 15: | ||
$ g++ HelloWorld.cc -o hello.x | $ g++ HelloWorld.cc -o hello.x | ||
$ ./hello.x | $ ./hello.x | ||
</syntaxhighlight> | |||
= Python = | |||
HelloWorld.py: | |||
<syntaxhighlight lang="python"> | |||
print "Hello, World!" | |||
</syntaxhighlight> | |||
To run it: | |||
<syntaxhighlight lang="bash"> | |||
$ python HelloWorld.py | |||
</syntaxhighlight> | |||
Alternatively: | |||
<syntaxhighlight lang="bash"> | |||
$ python -c "print 'Hello World! \n'" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 06:54, 5 October 2010
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
Python
HelloWorld.py:
print "Hello, World!"
To run it:
$ python HelloWorld.py
Alternatively:
$ python -c "print 'Hello World! \n'"