Code: Select all
[codebox=language file=codename]Your Code[/codebox]
language is the name of the programming language, e.g., matlab;
codename, is the file name, including extension, e.g., Hello.m (for MATLAB).
If I re-write the template above, it will look like:
Code: Select all
[codebox=matlab file=Hello.m]Your Code[/codebox]
MATLAB
- fprintf ( 1, '\n' );
- fprintf ( 1, 'HELLO:\n' );
- fprintf ( 1, ' MATLAB version\n' );
- fprintf ( 1, ' This is how to say:\n' );
- fprintf ( 1, '\n' );
- fprintf ( 1, ' Hello, world!\n' );
Python
- #! /usr/bin/env python
- def Hello ( ):
- print ( "Hello, world!" )
- return
- if ( __name__ == '__main__' ):
- Hello ( )
C
- {
- printf ( "Hello, world!\n" );
- return 0;
- }
C++
- #include <iostream>
- int main() {
- std::cout << "Hello, world!\n"; // Or
- std::cout << "Hello world!" <<std:: endl;
- return 0;
- }
FORTRAN77
- implicit none
- write ( *, '(a)' ) 'Hello, world!'
- stop
- end
Java
- public class HelloWorld {
- public static void main(String[] args) {
- System.out.println("Hello, world"); // Prints "Hello, world"
- }
- }
PHP
- <html>
- <head>
- <title>PHP Test</title>
- </head>
- <body>
- <?php echo '<p>Hello, world</p>'; ?>
- </body>
- </html>
R
- #Suppress quotes in the output
- print("Hello World!", quote = FALSE)