invalid type argument of ‘unary *’

I keep getting a invalid type argument of ‘unary *’ error and im not sure how to fix it.

my program worked fine before i added this bit
1
2
3
4
5
	float mwtheta ;
	mwtheta = 1 + f2[0]*f2[1]*(1/2*(*3* (cos(theta[0]))^2 *-1 )) 
			+ f4[0]*f4[1]* (1/8*(35*(cos(theta[0]))^4
			- 30 *(cos(theta[1]))^2 + 3));



here is the whole 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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include<iostream>	
#include<cmath>
#include<string>
#include<fstream>

using namespace std;

//======================================================================


int main () 
{

//FILLING DATA ARRAYS 
// ask user for dat file
 
	start:
	cout << "Input filename where the raw data exist-->";
	char filename [50];
	ifstream dat;
	cin.getline(filename,50);
	dat.open(filename);

// if file isnt there report error 

	if (!dat.is_open()){
		cout << "File Does Not Exist!" << endl ;
	goto start;
	}

// read from file  and fill arrays 
	
	float theta[20], wthe[20], errwth[20];	
	int x = 0; 



	float a,b,c,d,e,f;

	while (! dat.eof()){

		dat >>  a >>  b >>  c;

		theta [x] = a ;
		wthe [x] = b;
		errwth [x] = c;
		cout << errwth[x] << endl;//check to see if filled right
		++x;
	}

// SECOND ARRAY FILLING 
// fill arrays for testing models 

	beg:
	cout << "Input filename where the data table exist-->";
	char file [50];
	ifstream table;
	cin.getline(file,50);
	table.open(file);

// if file isnt there report error 

	if (!table.is_open()){
		cout << "File Does Not Exist!" << endl ;
	goto beg;
	}

	x = 0 	;
	float ji [10], jm [10], jf[10], l1[10], l2[10] ;
	float f2[10] , f4[10] ;

	while (! table.eof()){

		table >>  a >>  b >>  c >> d >> e >> f;

		jf [x] = a;
		ji [x] = b;
		l1 [x] = c;
		l2 [x] = d;
		f2 [x] = e;
		f4 [x] = f;

		++x;
	}		
 
// testing calls not in a subroutine to check if calc is correct 
	float mwtheta ;
	mwtheta = 1 + f2[0]*f2[1]*(1/2*(*3* (cos(theta[0]))^2 *-1 )) 
			+ f4[0]*f4[1]* (1/8*(35*(cos(theta[0]))^4
			- 30 *(cos(theta[1]))^2 + 3));


	cout << mwtheta << endl;

return 0 ;
}
			
(*3* Should be (3* on the second line of code you have
WOW !! i have been staring at that for 15 mins and didn't see it


not the error says "invalid operands of types ‘float’ and ‘float’ to binary ‘operator^’"

not sure what that means....
because you have ^ which is a binary operator I didn't even realize that the first time. use pow( number , topowerof );
thanks
Topic archived. No new replies allowed.