what is the c++ way of saying (float)Math
What are you trying to say with "(float)Math"?
cosu=(float)Math.cos(u) this is in java how do i say this in c++
//outer loop iterates over u u = -M_PI; for (i = nsides - 1; i >= 0; i--) { cosu = (float)Math.cos(u); sinu = (float)Math.sin(u); cosudu = (float)Math.cos(u+du); sinudu = (float)Math.sin(u+du); //the inner loop iterates over v v = -M_PI / 2.0f; for (j = rings; j >= 0; j--) { cosv = (float)Math.cos(v); sinv = (float)Math.sin(v); cosvdv = (float)Math.cos(v+dv); sinvdv = (float)Math.sin(v+dv);
i'm trying to convert java to c++
http://www.cplusplus.com/forum/general/16048/ Looks like you #include <math.h> then you just use global functions sin() and cos().
i already have that header
i can't get java code to work in c++ i wish there was a program translator between the two lol
Did you try sinu = sin(u); or maybe sinu = (float)sin(u); I don't know all the details of math.h, but you can google it and I'm sure find lots of info. Specifically the function prototypes (parameters and return types).
Porting one language to another is not trivial. Writing C++ is especially not trivial. Porting something to C++ will be a challenge. Good luck!
thanks for thinking for me lol i'm totally clueless about programming its a course required for my phd they make you take an advanced programming class and i have no experience lol
thank god i only have to take one computer class
Wow. You have to do C++ with no experience? That is...horrifying. You'll need more than luck.
lol c++ with open GL
there is one computer science person in the class the rest of us are pure math people
Well, I am absolutely positive that programming would be a good skill for any mathematician. Maybe not C++, but something like python at least.
maybe
thanks again for your help
np
Join our real-time social learning platform and learn together with your friends!