Hello, when I go to compile my code I keep returning the following errors:
41: error: expected ‘;’ before ‘}’ token
43: error: expected constructor, destructor, or type conversion before ‘=’ token [multiple occurances of this- lines 44, 48,49,54,55,60,61 ]
63: error: expected constructor, destructor, or type conversion before ‘<<’ token
66:error: expected constructor, destructor, or type conversion before ‘.’ token
Somebody please help, because I have never seen this error before and can't see what I am doing wrong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
//Orbital Data
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <fstream>
#include <cstdlib>
using namespace std;
#define PI 3.141592
//r=a+e(r*cos(p))
//find a and e using method of least squares
int main() {
double r[50],phi[50],rphi[50],ravg,rphiavg,a,e,cov,v;
int j,k;
ifstream orbitdata;
orbitdata.open ("orbits.dat");
if (!orbitdata) {
cerr<< "error:file will not open"<< endl;
exit(1);
}
k=0;
orbitdata >> phi[0] >> r[0];
while (orbitdata.good()){
k++;
orbitdata >> phi[k] >> r[k];
}
for (j=0;j<k;j++) {
rphi[j]=r[j]*cos(PI*phi[j]/180.);
// cout << phi[j] << " "<< r[j]<<"\n';
}
ravg=0;
rphiavg=0
// cout << rphiavg << "\n" ;
}
ravg=ravg/ ( double ) k;
rphiavg=rphiavg/ ( double ) k;
// cout << ravg << "\n" << rphiavg << "\n";
cov=0;
v=0
for (j=0; j<k;j++){
v=v+(rphi[j]-rphiavg)*(rphi[j]-rphiavg);
cov=cov+(rphi[j]-rphiavg)*(r[j]-ravg);}
cov=cov/(j);
v=v/(j);
//cout << "v =" << v<< "\n";
//cout << "cov = " << cov << "\n";
e=cov/v;
a=ravg-e*rphiavg;
cout << "e = " << e << "\n";
cout << "a = " << a << "\n";
orbitdata.clos();
return 0;
}
|