User defined function cosx

So it gives me pow no overloaded? Does that even make sense? It's also giving me a few syntax errors but i can't see why double on the first line of defining the function would be considered one... The purpose is to make a function that replicates the function of cosx.

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
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

double cosx(double x,int n)
{
	double c= pow(double x, (int n)*2);
	int d= pow(int k=-1, int n);
	
	for (double i=n;i>0;i--)
	{
		double f;

		i=(2*i)*(2*(i--));
		double e=i;
		
		f=c*d/e;
		return f;
	}
}

void main()
{
	double x;
	int n;
	bool done;
	done=false;

	cout<<"Enter the values of x and n respectively, where n is positive: ";
	cin>>x;

	while(!done)
	{
		cin>>n;
		
		if (n<0)
		{
			cout<<"Invalid entry for n!";
		}
		else
		{
			done=true;
		}
	}


	double cosx (double x,int n);
	cout<<cosx (double x,int n);

	char t;
	cin>>t;
}
So it gives me pow no overloaded? Does that even make sense?

Is there as question is there somewhere?
Yes, what do they mean
I have no idea what you mean.

Can you please start again. Assume we have no idea what you're talking about, explain what you're doing to give some context, then ask the question.
Topic archived. No new replies allowed.