converting arithmetic to c++

Sep 30, 2017 at 9:56am
is anyone here? i need help,
how to convert arithmetic to c++
Sep 30, 2017 at 10:01am
Hello adnria,

What have you done so far? Post what you have.

http://www.catb.org/esr/faqs/smart-questions.html

Andy

Edit: This is also a good place to start: http://www.cplusplus.com/doc/tutorial/
Last edited on Sep 30, 2017 at 10:03am
Sep 30, 2017 at 10:05am
can you give me your email, i cant upload here picture
Sep 30, 2017 at 10:30am
Hello adnria,

Click on my name then in the user profile click on "Send PM"so I can respond to it.

Andy
Sep 30, 2017 at 11:18am
Sep 30, 2017 at 11:20am
are you here
Sep 30, 2017 at 11:31am
closed account (48T7M4Gy)
Basic arithmetic operations are discussed in this tutorial:
http://www.cplusplus.com/doc/tutorial/operators/

The more complex math operations are the subject of this C++ library which has sample programs on how these are used:
http://www.cplusplus.com/reference/cmath/

Your equation is quite complex and you need to carefully break it down in the translation to code process using the above.

You may need to visit the whole tutorial on this site to come to grips with writing a program and getting some output from it. You can post your code in this thread at whatever stages of that you like if you need further help.

I'd start with a basic int main() program with a starting message and a cin/cout pair of statements to start with.
Sep 30, 2017 at 11:54am
If you can please translate to c++
It is my homework
Sep 30, 2017 at 11:55am
Hello adnria,

My algebra is not that good. I do not know if that formula can be reduced any farther. Not sure if this would work, but something like this:

[y * 25 * (in *in) * pow(x, 3 + 5 * p) * second part] / [x + (cos(2 * x) / (x * x)) + l]

cos, pow and sin can be found in the "cmath" header file.

Where I say "second part" I will have to think about that for a bit. Not sure what to do with it yet. At the end of the line I am not sure if that is a number one or the lower case letter "L".

The second part looks like l3x + sin3(7a) where the rhs of + would be sin3(7a) if I read this right.

Maybe someone else would have a better idea. At least a place to start from.

Hope that helps,

Andy
Sep 30, 2017 at 11:56am
Thanks
Sep 30, 2017 at 11:57am
Do you know if there is online translator?
Sep 30, 2017 at 12:22pm
closed account (48T7M4Gy)
If you can please translate to c++
It is my homework


This is not a homework site. You have been given enough help so far to enable you to try it yourself. You have already been invited to submit your attempts to get further help, but that is conditional on you doing some of the work.

As far as a translator is concerned I doubt there is one but again self-help is always an option for you and google may be the way forward for you. Good luck and best wishes with your search.
Sep 30, 2017 at 6:34pm
Heh, LOL, this feels like we’re being played.

Whatev.

1
2
3
y*2*pow(sin(pow(x,3+5*p)),2) * pow(e,3*x+pow(sin(7*a),3)) 
/
(x + (cos(2*x)/pow(x,y)) + 2);

(Presuming that last squiggle is a “2”.)

This is not a C++ question so much as a math question. Granted, most high-school / college-freshmen / friggin adults won't understand the equation either.

xy is exponentiation, and is written in C and C++ as pow(x,y).

sinyx is likewise exponentiation, but the notation is a shorthand for (sin x)y, which again you would write in C and C++ as pow(sin(x),y).

Remember to wrap everything in parentheses.
Oct 1, 2017 at 2:35am
I think some of the paid for tools may be able to generate C statements. I think matlab could be forced to do this, and probably mathmatica or maple.
I don't know of any free ones or online ones, but then I have never had to do that; I always just did it by hand. If this is school, your math computer lab may have tools like this that you can use; they all cost an arm and a leg when you get away from school though.

The readability and quality of said statements ... it probably gives the right answer, but beyond that you get what you get.
Last edited on Oct 1, 2017 at 2:36am
Topic archived. No new replies allowed.