Hello, I am trying to create a function that accepts an integer and a double and squares both values. I have to pass the values by reference. I am new to c++ and don't understand this and I do not understand functions very much when trying to pass more than 1 value. When the function returns I have to write out both values. I don't understand the return statement much either. Maybe if someone can set me on the right track I would appreciate it. Thank you! Sorry for the sloppy code!
// prototype
int Sqr(int &x, double &y);
int main()
{
int a;
double b;
cout << "Enter a number" << endl;
cin >> a;
cout << Sqr(a, b) << endl;
cout << "Enter a double" << endl;
cin >> b;
cout << Sqr(a, b) << endl;
return 0;
}
// function
int Sqr(int &x, double &y)
{
x = x * x;
y = y * y;
return 0;
}