error:expression must have integral or enum type

i get this error
here is the 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
29
30
31
32
33
34
35
36
37
38
39
  #include <iostream>
using namespace::std;

int main(){
	
	
    double c1,c3,c2,c4,c5,c6=0,c7,d;
	double x=0,y=0;
	double z=1.5;
	double w=0;	
	
	
    double f[]={7616,9140,10663,12187,13692,15234,11425,7616,7616,7616};
    for(int i=0;i<3;i++){
		c1=(y-x)/0.02;
		if(w!=0){
             c2=c5*0.02/2;
		}
		else{
			c2=0;
		}
		c3=c1+c2;
		d=-5.06*c3;
		c4=-999.6*y;
		c5=f[i]+d+c4;
		if(w!=0){
			c6=c5*0.02^2;
		}
		else{
			c6=0
		}


		
  cout<<"_________________________"<<endl;

	}
	getchar();
	return 0;

when i change the c6=c5*0.02^2; to c6=c5*0.0004 it compiles fine.
what's the problem?
closed account (z05DSL3A)
^ isn't what you think it is.

(it is a bitwise XOR operator)
Last edited on
Operator ^ is Bitwise Exclusive OR (XOR). It works only with integers.
http://www.cplusplus.com/doc/tutorial/operators/

However, if you want to raise a number to a power, use the pow() function.
http://www.cplusplus.com/reference/cmath/pow/
Topic archived. No new replies allowed.