|
[Sponsors] |
September 11, 2003, 12:16 |
help C++
|
#1 |
Guest
Posts: n/a
|
Hi,
I am new about C++. I want to calculate some functions in my programme, such as sin, cos, power, log, etc. Where can I find their expression in C++? Thanks! |
|
September 11, 2003, 12:39 |
Re: help C++
|
#2 |
Guest
Posts: n/a
|
You can find intrinsic functions (sin, min, exp, etc.) in the various include files available with the compiler you're using. Such as:
#include <math.h> |
|
September 11, 2003, 12:41 |
once more
|
#3 |
Guest
Posts: n/a
|
oops - The symbols I typed didn't show up last time. More explicitly, the syntax is:
#include (less than sign)math.h(greater than sign) |
|
September 11, 2003, 12:46 |
Re: once more
|
#4 |
Guest
Posts: n/a
|
Thank you very much.
I have good fortran knowledge. In #include <math.h>, how to express squared or power calculation? |
|
September 11, 2003, 14:17 |
Re: once more
|
#5 |
Guest
Posts: n/a
|
Hi, an example #include <cmath> #include <iostream> int main(void) { double a=10; // take e^a std::cout << exp(a) << std::endl; // take a^10 std::cout << pow(a,10) << std::endl; // take sinus(a) std::cout << sin(a) << std::endl; } M. http://panoramix.ift.uni.wroc.pl/~maq
|
|
September 11, 2003, 14:47 |
Re: once more
|
#6 |
Guest
Posts: n/a
|
Thank you very much.
I just try it. It is clear. |
|
|
|