CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

help C++

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 11, 2003, 12:16
Default help C++
  #1
flow
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!

  Reply With Quote

Old   September 11, 2003, 12:39
Default Re: help C++
  #2
cfd dude
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>
  Reply With Quote

Old   September 11, 2003, 12:41
Default once more
  #3
cfd dude
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)

  Reply With Quote

Old   September 11, 2003, 12:46
Default Re: once more
  #4
flow
Guest
 
Posts: n/a
Thank you very much.

I have good fortran knowledge. In #include <math.h>, how to express squared or power calculation?
  Reply With Quote

Old   September 11, 2003, 14:17
Default Re: once more
  #5
Maciej Matyka
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

  Reply With Quote

Old   September 11, 2003, 14:47
Default Re: once more
  #6
flow
Guest
 
Posts: n/a
Thank you very much.

I just try it. It is clear.

  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:30.