very odd compile errors

Well there is not much to say but that my compile errors are:

in function `int main()':
Line 17     non-lvalue in assignment
Line 19     non-lvalue in assignment
Line 23     `3.6525e+2' cannot be used as a function
Line 23     `3.06001000000000011880274541908875107765197753906e+1' cannot be used as a function 


and code

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
#include <iostream>
#include <iomanip>
using namespace std;
double d,m,y,a,b;
double jd;
int main()
{
    cout << "d" << endl;
    cin >> d;
    cout << "m" << endl;
    cin >> m;
    cout << "y" << endl;
    cin >> y;
    cout << endl;
cout << setprecision (16);
if (m>2) {
    y=y && m=m;
} else if ( m <= 2 ) {
    y = y - 1 && m = m + 12;
}
a = (y/100);
b = 2 - a + (a / 4);
jd = (365.25(y +4716)) + (30.6001(m+1)) + d + b - 1524.5; 

cout << "= " << jd << endl;
cin.get();
return 0;
}

the compile errors are weird especially line 23 because it is saying I can't use
numbers as a function which I am not.




Last edited on
grumble grumble

Don't repost: http://cplusplus.com/forum/general/18398/
Last edited on
go with Disch
try creating a floating point variables or use doubles for values 365.25, 30.6001 and 1524.5.
for example

1
2
3
float a = 365.25;
float b = 30.6001;
float c = 1524.5;

or
1
2
3
double a = 365.25;
double b = 30.6001;
double c = 1524.5;

or you can try
jd = (365.25*(y +4716)) + (30.6001*(m+1)) + d + b - 1524.5;
Last edited on
Topic archived. No new replies allowed.