Difference between revisions of "Hello World"
From Coder Merlin
Line 1: | Line 1: | ||
== Assembly Language == | |||
{{CodeExplorer | {{CodeExplorer | ||
|exerciseID=1 | |exerciseID=1 | ||
Line 10: | Line 11: | ||
mov $1, %rax # system call 1 is write | mov $1, %rax # system call 1 is write | ||
mov $1, %rdi # file handle 1 is stdout | mov $1, %rdi # file handle 1 is stdout | ||
mov $message, %rsi | mov $message, %rsi # address of string to output | ||
mov $13, %rdx | mov $13, %rdx # number of bytes | ||
syscall # invoke operating system to do the write | syscall # invoke operating system to do the write | ||
Line 21: | Line 22: | ||
message: | message: | ||
.ascii "Hello, world!" | .ascii "Hello, world!" | ||
}} | |||
== C == | |||
{{CodeExplorer | |||
|exerciseID=2 | |||
|height=100 | |||
|language=c | |||
|initialCode= | |||
#include <stdio.h> | |||
int main() { | |||
printf("Hello, world!"); | |||
return 0; | |||
} | |||
}} | |||
== C++ == | |||
{{CodeExplorer | |||
|exerciseID=3 | |||
|height=100 | |||
|language=cpp | |||
|initialCode= | |||
#include <iostream> | |||
int main() { | |||
std::cout << "Hello, world!"; | |||
return 0; | |||
} | |||
}} | }} |