Task:
Write a function:
 exp(x,y):
 where x is positive (possibly a decimal) and y is a positive integer.
 Returns x to the y.
 The definition of x to the y: x multiplied by itself y times.
 Example: 2 to the 3 is 2*2*2.
 Example: 6 to the 1 is 6.
 Example: 12 to the 0 is 1. Anything to the 0 is 1, except 0. But you don't have to worry about 0.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

#include <iostream>
using namespace std;
double exp(double&x,int y)
{
int n=1;
for(int=n;n<=y;n++)
n=n*x;
return n;
}
int main()
{
double x;
int y;
cout<<"Enter two numbers ";
cin>>x>>y;
exp(x,y);
cout<<x<<endl;
return 0;
}
 
Error being produced
$ g++ exp.cpp o exp
exp.cpp: In function `double exp(double&, int)':
exp.cpp:6: error: expected primaryexpression before "int"
exp.cpp:6: error: expected `;' before "int"
exp.cpp:7: warning: converting to `int' from `double'
I am confused with the algorithm of the function. If anyone can help me fix this and explain to me, I would very much appreciated it.