Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 01-17-2014, 10:06 AM   #1
Solid State Member
 
Join Date: Jun 2012
Location: --------------
Posts: 19
Default 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.
__________________

faslan is offline   Reply With Quote
Old 01-17-2014, 02:52 PM   #2
Fully Optimized
 
jmacavali's Avatar
 
Join Date: Jun 2009
Posts: 4,867
Default 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!"
****************************************
jmacavali is offline   Reply With Quote
Old 01-17-2014, 06:15 PM   #3
Baseband Member
 
Join Date: Dec 2013
Location: England
Posts: 72
Default Re: please give the code for this

er what? Go home maths your drunk....
AnthonyMcEwen is offline   Reply With Quote
Old 01-18-2014, 11:47 AM   #4
Solid State Member
 
Join Date: Jun 2012
Location: --------------
Posts: 19
Default Re: please give the code for this

Quote:
Originally Posted by faslan View Post
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
faslan is offline   Reply With Quote
Old 01-19-2014, 04:18 PM   #5
In Runtime
 
lhamil64's Avatar
 
Join Date: Jan 2007
Posts: 398
Default Re: please give the code for this

Quote:
Originally Posted by faslan View Post
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: http://lhamil64.wordpress.com
lhamil64 is offline   Reply With Quote
Old 01-20-2014, 02:06 PM   #6
In Runtime
 
Join Date: Feb 2013
Location: UK
Posts: 156
Default 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!
__________________

_michaelm is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 08:15 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0