ANY HELP YOU CAN PROVIDE WILL BE GREAT. Here is the code Im trying to convert. This is my 1st time hearing about SRC Code and my teacher isnt being a big help. Please help in any way you can. Here is the code:

int a = -5;
int b = 3;
int c;
if (a == b) /*Case 1*/
c = -1;
else if (a > b) /*Case 2*/
c = a-b;
else /*a < b,Case 3*/
c = 2a + b;

This is the link to the full asignment
http://i806.photobucket.com/albums/y...5/Program1.jpg

Edited 6 Years Ago by liljazz2007: ANY HELP YOU CAN PROVIDE WILL BE GREAT.

>This is my 1st time hearing about SRC Code and my teacher isnt being a big help.
Presumably you learned about SRC assembly in class, otherwise your teacher wouldn't give the assignment. The link doesn't work, so I can't see your assignment. Perhaps if you gave some more details on the language, someone can help. Otherwise, all I can offer is an idea of how the conditional logic might flow in pseudo assembly:

cmp a, b
  jne elseif
  mov c, -1
  jmp endif
elseif:
  jle else
  mov c, a
  sub c, b
  jmp endif
else:
  mov c, 2
  mul c, a
  add c, b
endif:

Actually we did one class of src and nothing since then. Here is the link
http://i806.photobucket.com/albums/yy346/sexyjaz12345/Program1.jpg

>This is my 1st time hearing about SRC Code and my teacher isnt being a big help.
Presumably you learned about SRC assembly in class, otherwise your teacher wouldn't give the assignment. The link doesn't work, so I can't see your assignment. Perhaps if you gave some more details on the language, someone can help. Otherwise, all I can offer is an idea of how the conditional logic might flow in pseudo assembly:

cmp a, b
  jne elseif
  mov c, -1
  jmp endif
elseif:
  jle else
  mov c, a
  sub c, b
  jmp endif
else:
  mov c, 2
  mul c, a
  add c, b
endif:

Im not asking anyone to give my the answer to my problem just some help! I have tried googling for help and that has not work. Hope you have a blessed day.

>Actually we did one class of src and nothing since then.
Then you should know the basic instructions required. Your question is no longer about C++. Rather, it's about SRC assembly, and it shouldn't be difficult to translate my pseudo assembly to SRC.

This article has been dead for over six months. Start a new discussion instead.