1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Little Man Computer

Discussion in 'Software Development' started by badboy123, Nov 11, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. badboy123

    badboy123 Thread Starter

    Joined:
    Nov 11, 2011
    Messages:
    3
    Hi, i need a LMC program written that outputs the smallest of three numbers?


    Thanks.
     
  2. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    I'm sorry, but we don't generally do people's homework for them. If you can show that you're working on some code but have a specific problem, you might get some help but still have to do the work yourself. Otherwise how would you learn?
     
  3. sepala

    sepala

    Joined:
    May 20, 2010
    Messages:
    4,038
    Ent is correct. What you are asking is a simple thing, a simple math. That's all. Apart from that, some Programming languages has methods to do this for you too..
     
  4. badboy123

    badboy123 Thread Starter

    Joined:
    Nov 11, 2011
    Messages:
    3
    This is what ive done so far:

    My flowchart is summat like this:

    Input A, B, C ---> is A<B ----> If yes, ----> is A<C -------> if Yes, output A, if no output C
    Input A, B, C ----> is A<B ----> If No -----> is B<C -------> If yes, output B, if no output C



    MB Op-Code Description
    00 901 Input A
    01 397 Store A in MB 97
    02 901 Input B
    03 398 Store B in MB 98
    04 297 Subtract A from B
    05 808 If positive, go to MB 08
    06 598 Load MB 98 (B)
    07 616 Send to MB 16
    08 597 Load MB 97 (A)
    09 901 Input C
    10 399 Store C in MB 99
    11 297 Subtract A from C
    12 821 If positive, go to MB 21
    13 599 Load MB 99
    14 902 Output MB 99 (C)
    15 000 HALT
    16 901 Input the data received from MB 07 (B)
    17 398 Store B in MB 98
    18 299 Subtract B from C
    19 821 If positive, go to MB 21
    20 599 Load MB 99 (C)
    21 902 Output
    22 000 HALT
    23 598 Load MB 98
    24 902 Output
    25 000 HALT
    97 000 DATA
    98 000 DATA
    99 000 DATA

    I think its ok but not sure
     
  5. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    So what goes wrong when you try to run this?
     
  6. badboy123

    badboy123 Thread Starter

    Joined:
    Nov 11, 2011
    Messages:
    3
    I havent tried running this. I just wanted to know whether it was correct, as i am new to this and this is only a sample question. Its not the actual exam question.
     
  7. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    In that case I suggest you just run it and see what it makes of a few combinations of values. LMC is designed to give you a run through of what your computer is doing, it can explain things much better than we can.

    Remember when testing to give it values that it should find easy and values that might confuse it (e.g. how does it handle the two numbers being equal?)
     
  8. Cookiegal

    Cookiegal Administrator Malware Specialist Coordinator

    Joined:
    Aug 27, 2003
    Messages:
    115,815
    First Name:
    Karen
    I'll close this now since we don't assist with homework.
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Little Computer
  1. charlzguitarz
    Replies:
    4
    Views:
    957
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1026448

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice