neuerlehrplan:klasse10:algorithmusbegriff
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
neuerlehrplan:klasse10:algorithmusbegriff [2025/05/15 10:20] – [Grundsätzliches Vorgehen beim Programmieren mit textorientierten Sprachen] lutz | neuerlehrplan:klasse10:algorithmusbegriff [2025/05/15 10:46] (aktuell) – [Beispiel: "Hallo Welt!"-Programm in Python] lutz | ||
---|---|---|---|
Zeile 60: | Zeile 60: | ||
* Bei Interpretersprachen wird das Programm direkt mit dem Interpreter aufgerufen und dadurch ausgeführt. | * Bei Interpretersprachen wird das Programm direkt mit dem Interpreter aufgerufen und dadurch ausgeführt. | ||
- | ====Beispiel: | + | ====Beispiel: |
+ | |||
+ | <code asm hallo.asm> | ||
+ | section .text | ||
+ | global _start | ||
+ | _start: | ||
+ | mov edx, len ;message length | ||
+ | mov ecx, msg ;message to write | ||
+ | mov ebx, 1 ;file descriptor (stdout) | ||
+ | mov eax, 4 ;system call number (sys_write) | ||
+ | int 0x80 | ||
+ | mov eax, 1 ;system call number (sys_exit) | ||
+ | int 0x80 | ||
+ | |||
+ | section .data | ||
+ | |||
+ | msg db ' | ||
+ | len equ $ - msg ; | ||
+ | </ | ||
+ | |||
+ | Aufruf des Assemblers in der Kommandozeile: | ||
+ | |||
+ | < | ||
+ | nasm -f elf64 hallo.asm | ||
+ | </ | ||
+ | |||
+ | Programm linken: | ||
+ | |||
+ | < | ||
+ | ld hallo.o -o hallo | ||
+ | </ | ||
+ | |||
+ | Programm ausführen: | ||
+ | |||
+ | < | ||
+ | ./hallo | ||
+ | </ | ||
+ | |||
+ | Ausgabe: | ||
+ | < | ||
+ | Hello, world! | ||
+ | </ | ||
+ | |||
+ | ====Beispiel: | ||
+ | |||
+ | <code c hallo.c> | ||
+ | #include < | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | printf(" | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Programm compilieren: | ||
+ | |||
+ | < | ||
+ | gcc hallo.c -o hallo | ||
+ | </ | ||
+ | |||
+ | Programm ausführen: | ||
+ | |||
+ | < | ||
+ | ./hallo | ||
+ | </ | ||
+ | |||
+ | Ausgabe: | ||
+ | < | ||
+ | Hello, world! | ||
+ | </ | ||
+ | |||
+ | ====Beispiel: | ||
+ | |||
+ | <code python hallo.py> | ||
+ | print (" | ||
+ | </ | ||
+ | |||
+ | Programm ausführen: | ||
+ | |||
+ | < | ||
+ | python hallo.py | ||
+ | </ | ||
+ | |||
+ | Ausgabe: | ||
+ | < | ||
+ | Hello, world! | ||
+ | </ |
neuerlehrplan/klasse10/algorithmusbegriff.1747297233.txt.gz · Zuletzt geändert: von lutz