Sería muy interesante ver dichas soluciones, no dudes en compartirlas.
![:D :D](https://forum.elhacker.net/Smileys/navidad/cheesy.gif)
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú:menu
set /p nombre=
if not defined nombre (goto:menu)
inicio miPrimerProgramaEnGLHBR
entero x = 3;
leer(x)
fin;
inicio Hello_Shit
entero x = 123;
inc(x, 2 * 3)
fin;
inicio X
entero x = 1;
write(x);
repetir
x = x + 5;
x = x - 4
hasta x == 10
fin;
inicio X
entero z = 1234 + 234 + 56 + 78;
infinito hacer
z = z + 12
porsiempre
fin;
inicio X
entero x = (3 * 69 - (5 * 85 - 14))
fin;
;Código P para las sentencias enteras sencilla para el programa final.glhbr
ldc 3
ldc 69
mpi
ldc 5
ldc 85
mpi
ldc 14
sbi
sbi
; Código ensamblador para el programa "final.glhbr"
MOV R0,#3 ; Cargamos 3
MOV R1,#69 ; Cargamos 69
MUL R0,R1 ; Multiplicamos
MOV R1,#5 ; Cargamos 5
MOV R2,#85 ; Cargamos 85
MUL R1,R2 ; Multiplicamos
MOV R2,#14 ; Cargamos 14
SUB R1,R2 ; Restamos
SUB R0,R1 ; Restamos
MOV x,R0 ; fin de la sentencia de asignación
; Rutina para mostrar el resultado de x
; R = -204.0
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
if(argc != 3)
return EXIT_FAILURE;
printf("%.2f\n", atof(argv[1]) / atof(argv[2]));
return EXIT_SUCCESS;
}
C:\Users\leo\batch>type ticket.txt
Ticket Nro. 12
Fecha: 05/01/12 Hora: 02:20
3 AMARILLO LEDERNIL E - EURO $27,00
1 AMARILLO LEDERNIL RP - EURO $13,00
1 AMARILLO LEDERNIL L - EURO $10,40
-------
TOTAL $50,40
C:\Users\leo\batch>
C:\Users\leo\batch>code.cmd
C:\Users\leo\batch>type factura.txt
@ A S
B AMARILLO LEDERNIL E - EURO 3.0 9.00 21.0 M 0.0 0 b
B AMARILLO LEDERNIL RP - EURO 1.0 13.00 21.0 M 0.0 0 b
B AMARILLO LEDERNIL L - EURO 1.0 10.40 21.0 M 0.0 0 b
C P Subtotal 0
D Efectivo 100.00 T 0
E
C:\Users\leo\batch>
@echo off
setlocal enabledelayedexpansion
set /a count=0
for /f "tokens=*" %%_ in ('type "ticket.txt" ^| findstr /r "^..[0-9].*$"') do (set "productos[!count!]=%%_" & set /a count+=1)
set /a count-=1
for /l %%_ in (0, 1, %count%) do (
for /f "tokens=1 delims= " %%# in ("!productos[%%_]!") do (
set "descripcion_final[%%_]=%%#"
)
)
for /l %%_ in (0, 1, !count!) do (
for /f "tokens=1* delims=$" %%a in ("!productos[%%_]!") do (call:process %%a)
set "descripcion_final[%%_]=!descripcion_final[%%_]!;!s!;"
set /a i+=1
)
for /l %%_ in (0, 1, %count%) do (
for /f "tokens=2 delims=$" %%a in ("!productos[%%_]!") do (set "precio=%%a")
set "descripcion_final[%%_]=!descripcion_final[%%_]!!precio:,=.!"
)
:: Generar "factura.txt"
echo @ A S > "factura.txt"
for /l %%_ in (0, 1, %count%) do (
for /f "tokens=1,2,3 delims=;" %%a in ("!descripcion_final[%%_]!") do (
for /f "tokens=*" %%x in ('div %%c %%a') do echo B %%b %%a.0 %%x 21.0 M 0.0 0 b >> "factura.txt"
)
)
echo C P Subtotal 0 >> "factura.txt"
echo D Efectivo 100.00 T 0 >> "factura.txt"
echo E >> "factura.txt"
goto:eof
:process
for /f "tokens=1*" %%a in ("%*") do (set "s=%%b")
goto:eof
for /f "tokens=*" %%x in ('div %%c %%a') do echo B %%b %%a.0
div.exe 10.0 2.0
http://www.megaupload.com/?d=OWC2YJSN