Cài đặt trình soạn thảo gedit: sudo apt-get install gedit
1) .pas (sudo apt-get install fpc)
$fpc Hello.pas
$./Hello
2) .c (sudo apt-get install build-essential)
$gcc Hello.c -o Hello
$./Hello
.cpp (sudo apt-get install build-essential)
$g++ Hello.cpp -o Hello
$./Hello
3) .java (sudo apt-get install openjdk-6-jdk)
$javac Hello.java
$java Hello
4) .asm (sudo apt-get install as31 nasm)
$nasm -f elf32 Hello.asm //(hoặc elf64)
$ld -s -o Hello Hello.o
$./Hello
A) Hello.pas ($gedit Hello.pas)
program Hello;
uses crt;
begin
write(‘Hello World!’);
readln;
end.
B) Hello.c ($gedit Hello.c)
#include<stdio.h>
int main()
{
printf(“Hello World!”);
return 0;
}
Hello.cpp ($gedit Hello.cpp)
#include<iostream>
int main()
{
std::cout << “Hello World!\n”;
return 0;
}
C) Hello.java ($gedit Hello.java)
import java.util.*;
public class Hello
{
public static void main(String[] args)
{
System.out.print(“Hello World!”);
}
}
D) Hello.asm ($gedit Hello.asm)
section .text
global _start
_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
GHI CHÚ NGÔN NGỮ:
.pas –> Pascal, .c và .cpp –> C/C++, .java –> Java, .asm –> Assembly