Computer Forums please give the code for this

 01-17-2014, 10:06 AM #1 Solid State Member   Join Date: Jun 2012 Location: -------------- Posts: 19 please give the code for this Translate the expression IF X = 4 THEN X = X + P × Q + 3 into a low-level language form using any low-level languageyou wish. Define the action of any instruction you use. __________________ __________________
 01-17-2014, 02:52 PM #2 Fully Optimized     Join Date: Jun 2009 Posts: 4,867 Re: please give the code for this PxQ = (-3) __________________ __________________ **************************************** Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie? I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!" ****************************************
 01-17-2014, 06:15 PM #3 Baseband Member   Join Date: Dec 2013 Location: England Posts: 72 Re: please give the code for this er what? Go home maths your drunk.... __________________
01-18-2014, 11:47 AM   #4
Solid State Member

Join Date: Jun 2012
Location: --------------
Posts: 19
Re: please give the code for this

Quote:
 Originally Posted by faslan Translate the expression IF X = 4 THEN X = X + P × Q + 3 into a low-level language form using any low-level languageyou wish. Define the action of any instruction you use.
using C language
__________________

01-19-2014, 04:18 PM   #5
In Runtime

Join Date: Jan 2007
Posts: 398
Re: please give the code for this

Quote:
 Originally Posted by faslan Translate the expression IF X = 4 THEN X = X + P × Q + 3 into a low-level language form using any low-level languageyou wish. Define the action of any instruction you use.
This is fairly trivial in any C-based language, especially since you don't even need to worry about order of operation or anything.

In fact, you can almost type this word-for-word into C and get a working result. Assuming you have the variables P and Q defined and initialized already, it would just mean adding three characters and removing the THEN.

I don't want to just give you the code because this sounds like a homework assignment. If you try it and post your attempt here, we can tell you what you did wrong.
__________________
--Lee
Website/Blog: https://lhamil64.wordpress.com

 01-20-2014, 02:06 PM #6 In Runtime   Join Date: Feb 2013 Location: UK Posts: 156 Re: please give the code for this Agreed with Ihamil64, this is clearly a homework assignment. At least make an attempt and we can indicate errors, but don't blindly post without any effort of your own - it's pointless and wastes everyone's time. Writing the question on this forum took more effort than finding the answer and writing the code, as pointed out above - you've practically written the entire thing in English (or rather, the question setter did) - so it could hardly be any simpler! __________________ __________________