#include <cmath>
#include <iostream>
using namespace std;
void F2(int, int, int, int&, int&, int&);
int main ( void )
{
int X=1, Y=2, Z=3, A=4, B=5, C=6, A1=7, A2=8, A3=9;
F2(X, Y, Z, A, B, C);
cout << "X=" << X << "Y=" << Y <<endl;
cout << "Z=" << Z << "A=" << A <<endl;
cout << "B=" << B << "C=" << C <<endl;
cout << "A1=" << A1 << "A2=" << A2 << endl;
cout << "A3=" << A3 << endl;
system ("Pause");
return 0;
}
void F2(int X, int Y, int Z, int&A1, int& A2, int&A3)
{
X=X+5;
A1=A1*A1;
A2=(Y + Z)/2;
A3= (Y-Z)/2;
return;
}
the program outputs are X=1, Y=2, Z=3, A=16, B=2, C=0, A1=7, A2=8, and A3=9.
My question is how? For a quick example, in the function definition A1=A1*A1 which would be 49, why is the output 7. I'm assuming one I understand that one all the others would make sense. Thank you very much.