little-man-computer

e-LMC extended Little Man Computer bubble embedded program continuous input

自作多情 提交于 2021-02-17 07:01:22
问题 I am looking for a e-LMC extended little man computer program that will accept an indefinite inputs and bubble-sort them. I need to have more inputs continuous and then do the bubble sort. INP //read 1st value STA 0 // for store INP // read 2nd value STA 1 // store INP // read 3rd value STA 2 // store LDA 1 // LOOP 1, STEP 1: SUB 0 // BRP STEP2 // if R0 and R1 are in order, don't swap them LDA 1 // Begin swapping registers STA 3 LDA 0 STA 1 // R1 = R0 LDA 3 STA 0 //R0 = temp STEP2 LDA 2 //

Program to sum input numbers is not working

一个人想着一个人 提交于 2021-01-29 09:41:54
问题 I am trying to make a program that first takes n inputs from the user, and then calculates the sum of those numbers. Then I want the program to print if the sum is an even or an odd number. For example if the user types in 3, he/she will have to type in 3 numbers (for example 3, 2, 5): then the program will calculate the sum of those (3 + 2 + 5) and print out if the answer (10) is an odd or an even number. I thought I coded it right, but it doesn't run in the LMC simulator, can someone please

max/min of an unknown number of inputs in LMC?

倾然丶 夕夏残阳落幕 提交于 2021-01-28 05:14:18
问题 How can I print the maximum/minimum of an unknown number of inputs in LMC? I know that I can SUB INPUT 1 FROM INPUT 2 and see if it is negative or positive but I don't know how to name the inputs so that I can load them. PS: I found this useful link to help me with the ''unknown number of inputs" part How can I store an unknown number of inputs in different addresses in LMC (little-man-computer)? 回答1: You link to code that stores an undetermined number of input values. But in your case that