Friday, May 10, 2013

First Try of Inserting Source Codes

Hightlight the source code with google code-prettify in two simple steps:
  1. add the following script to the HTML file:
    <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
  2. wrap the code piece with <pre class="prettyprint"> </pre> tag pair
Hello World in Java
public class Test {
  public static void main(String args[]) {
    System.out.println("Hello World!");
  }
}
Hello World in C
include <stdio.h>

int main() {
  printf("Hello World!");
  return 0;
}
Hello World in C++
include <iostream>
using namespace std;

int main() {
  cout<<"Hello World!";
  return 0;
}
HelloWorld in Assembly:
section .text
global _start
(ld)

_start:

  mov edx,len
  mov ecx,msg
  mov ebx,1
  mov eax,4
  int 0x80
  
  mov eax,1
  int 0x80

section .data

msg db 'Hello, World!',0xa
len equ $ - msg
HelloWorld in Python:
print "Hello World!"

No comments:

Post a Comment