hi
CODE
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
float u[3], v[3], num, denom, dot_prod3;
double cos_theta, angle_radians, theta;
float pi = 3.141592653589;
//define two vectors, and the dot product
int i, j, n = 4;
int main(){
for(j = 1; j < n; j++){
// get x vector components
cout<< "u_"<< j <<"= ? " <<flush;
cin >> u[j];
// get y vector components
cout<< "v_"<< j <<"= ? " <<flush;
cin >> v[j];
}
num = (u[1] * v[1]) + (u[2] * v[2]) + (u[3] * v[3]);
denom = (sqrt((u[1] * u[1]) + (u[2] * u[2]) + (u[3] * u[3])))*
(sqrt((v[1] * v[1]) + (v[2] * v[2]) + (v[3] * v[3])));
cos_theta = num/denom;
angle_radians = acos(cos_theta);
theta = (angle_radians * 180)/pi;
cout<<setprecision(2);
cout <<"Angle is: "<< theta <<" degrees approx"<<endl;
if(fabs(cos_theta) <= pow((float 10 , -6))
cout<<"vectors are orthogonal"<<endl;
cout<<"\n";
return 0;
}
It's a syntax error: cpp(35) : error C2143: syntax error : missing ')' before 'constant', on line 35 in my compiler, I've tried various ways of using parenthesis to no avail!!
help appreciated.