I am trying to import the "Exponent" function from library.cpp to main.cpp, but I am getting
error: no matching function for call to 'Exponent'
else if (op == "**") {result = Exponent(x,y);}
main.cpp
#include <iostream>
#include <cmath>
#include "library.cpp"
using namespace std;
int main() {
int x;
int y;
int result;
string op;
cout << "CALCULATOR" << endl;
cout <<"Enter two numbers then an operator" << endl;
cout << "1st Number: ";
cin >> x;
cout << "2nd Number: ";
cin >> y;
cout << "Operator(+,-,*,/,**): ";
cin >> op;
if (op == "+") {result = x + y;}
else if (op == "-") {result = x - y;}
else if (op == "*") {result = x * y;}
else if (op == "/") {result = x / y;}
else if (op == "**") {result = Exponent(x,y);}
cout << x << " " << op << " " << y << " = " << result <<endl;
return 0;
}
library.cpp
int Exponent(int x,int y, int result) {
for(int i = 0; i < y; ++i)
{
return result = result + x * x;
}
}