Hi everyone, I am working with MARIE and need help with the following: Write the equivalent C++ code in MARIE:

/ cin >> Max;
/ Count = 0;
/ Sum = 0;
/ While (Count < Max){
/ Count++;
/ cin >> Number;
/ cout << Number;
/ if (Number > 0) then
/ Sum = Sum + Number;}
/ cout << Sum;

        ORG 100
        Input
        Store Max
Test,   Load Count
        Skipcond 800
        Jump Loop

Loop,   Load Count
        Add One
        Store Count
        Input 
        Output Number
        Store Number
        Skipcond 000
        Jump If
        Jump Test

If,     Load Sum
        Add Number
        Store Sum
        Output
        Jump Test
    Halt

Max,    Dec 0
Count,  Dec 0
One,    Dec 1
Number, Dec 0
Sum,    Dec 0          

I keep getting an infinite loop and it is because of my Test, Skipcond, I do not know how to Test for while(count

Recommended Answers

All 9 Replies

you are in the java forum. my first suggestion, move to c++ forum as you need help writing c++ code.

you are in the java forum. my first suggestion, move to c++ forum as you need help writing c++ code.

"MarieSim was written in the Java language so that the system would be portable to any
platform for which a Java Virtual Machine (JVM) is available. Students of Java may
wish to look at the simulator's source code, and perhaps even supply improvements or
enhancements to its simple functions."
wcla.csie.chu.edu.tw/course/computer-org/lecture/MarieGuide.pdf

I see you didn't read the directions, don't worry here they are again: Write the equivalent C++ code in MARIE.

Please guys don't post retarded replies, if you have no suggestions then troll around somewhere else.

commented: Seems you have little ground to call him retarded for your own mispost. -4

So everyone is supposed to know what some obscure "MARIE" simulator is? As bibki pointed out, you're in the Java forum - which MARIE is not. "Written in Java" != Java.

No need to be a jerk when you are the one posting in the wrong forum about some simulator syntax.

MARIE is written in the Java language, that's why I post here. I also see you
didnt read my previous post, don't worry here it is again: Please guys don't post retarded replies, if you have no suggestions then troll around somewhere else.

include <lou>,
MARIE stands for Machine Architecture that's Real Intuitive and Easy. It is built in Java, but the code you need to write in c++ is not Java code. That is rather a weak imitation of assembly code I think. That code works with the architecture that MARIE represents, that is assembly. And you need to write that in c++. take your question to c++ forum because the language that is used to build a virtual architecture, in this case MARIE, has nothing to do with the code you posted and your assignment.

AND, I really do not care if someone calls me retarded on a forum. But in real life, I'd might mike-tyson one's butt.

I don't know where you keep getting this ideas that I need help with C++, I need help with writing the equivalent C++ code in MARIE. Also that whole Tyson thing, calm down I'd fuck you up kid.

if your code is c++ you need to put it in a language that MARIE understands. if your code is not in c++, it is in the language MARIE understands, in that case, you'd need to write it in c++. anyways, this "Write the equivalent C++ code in MARIE" tells me that you need to write some code, and the way I understand English, you are asked to write c++ code...

Ok, this thread is going nowhere fast.

The bottom line is that the syntax that MARIE expects has no resemblance at all to Java and therefore the Java forum will be of no help whatsoever. Computer Science or Legacy and Other Languages might yield something.

Edit: I'm going to move this into Computer Science, since it seems to be related to teaching architecture.

lou i use a current loop position variable and subtract my max number. then skipcond for 0

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.