- Joined
- Jul 25, 2009
- Sythe Gold
- 0
- Messages
- 251
This is for an equation for the time it takes a pendlum to swing
#include <iostream>
#include <cmath>
#define PI 3.14159
#define G 9.8 //Gravity
using namespace std;
int main()
{
double l;
double e;
cout << "Enter Lengh of Rod\n";
cin >> l;
cout << "The time it takes from one swing is ";
cout << 2*PI*((l/G)^(1/2));
cin >> e;
return 0;
}
i get error; invalid operands of types `double' and `int' to binary `operator^'
HELP!!
thanks
#include <iostream>
#include <cmath>
#define PI 3.14159
#define G 9.8 //Gravity
using namespace std;
int main()
{
double l;
double e;
cout << "Enter Lengh of Rod\n";
cin >> l;
cout << "The time it takes from one swing is ";
cout << 2*PI*((l/G)^(1/2));
cin >> e;
return 0;
}
i get error; invalid operands of types `double' and `int' to binary `operator^'
HELP!!
thanks





