Lab 1- After completing this lab we were able to create a program to convert decimal to Roman numerals. The program will also continue to ask users to enter numbers until user enters 0 to exit the program.
program dectorom; #include("stdlib.hhf") static n:int32; begin dectorom; stdout.put("Enter a decimal number, ",nl "To exit press 0: ") nl; stdin.get(n); mov(n,eax); while(eax!=0)do while(eax!=0)do if(eax >= 1000 ) then stdout.put("M"); sub(1000,eax); elseif(eax >= 900 ) then stdout.put("CM"); sub(900,eax); elseif(eax >= 500 ) then stdout.put("D"); sub(500,eax); elseif(eax >= 400 ) then stdout.put("CD"); sub(400,eax); elseif(eax >= 100 ) then stdout.put("C"); sub(100,eax); elseif(eax >= 90 ) then stdout.put("XC"); sub(90,eax); elseif(eax >= 50 ) then stdout.put("L"); sub(50,eax); elseif(eax >= 40 ) then stdout.put("XL"); sub(40,eax); elseif(eax >= 10 ) then stdout.put("X"); sub(10,eax); elseif(eax >= 9 ) then stdout.put("IX"); sub(9,eax); elseif(eax >= 5 ) then stdout.put("V"); sub(5,eax); elseif(eax >= 4 ) then stdout.put("IV"); sub(4,eax); elseif(eax >= 1 ) then stdout.put("I"); sub(1,eax); endif; endwhile; stdout.put(nl "Enter a decimal number, ",nl "To exit press 0: ") mov(0,n); stdin.get(n); stdout.put(nl "You have entered ", n, nl); mov(n,eax); endwhile; stdout.put(nl, "Program closing."); ; end dectorom;