### converting arithmetic to c++

is anyone here? i need help,
how to convert arithmetic to c++

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

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

Andy
are you here
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.

If you can please translate to c++
It is my homework

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
Thanks
Do you know if there is online translator?
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.
Heh, LOL, this feels like we’re being played.

Whatev.

 ``123`` ``````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.
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
Topic archived. No new replies allowed.