Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginner's question

Status
Not open for further replies.

efulton1

Technical User
Joined
Dec 3, 2001
Messages
1
Location
US
This is probably the dumbest question ever, but I just started using C++ today. When I try to multiply two constants of type "double" I get an error: "Illegal use of floating point in function..." How do you do this correctly? Here is basically what I have going on:

const double deltax = 1E-9;
const double deltat = 2E-15;
const double alpha = 1.27E-4;
double Fo;

Fo = alpha*deltax/deltat^2;

Thanks.
 
There is no such thing as deltat^2 in C++.

To raise to the power of 2, use

pow(deltat, 2)

Also be sure to include <cmath>
 
Greetinx!

or deltat*deltat. Happy programming!))
 
Status
Not open for further replies.

Similar threads

Replies
0
Views
288
  • Locked
  • Question Question
Replies
2
Views
394
Replies
1
Views
292
  • Locked
  • Question Question
Replies
3
Views
354

Part and Inventory Search

Sponsor

Back
Top