#include
int f1 (int, int, int);
int f2 (int&, int&, int&);
int f3 (int, int&, int);
void main ()
{
int i, j, k;
i=1;
j=2;
k=3;
cout << endl;
cout << "Initial values of i, j, and k are: "
<< i << ", " << j << ", and " << k << endl << endl;
cout << "f1(i,j,k) = " << f1(i,j,k) << endl;
cout << "Values of i, j, and k after the call to f1 are: "
<< i << ", " << j << ", and " << k << endl << endl;
cout << "f2(i,j,k) = " << f2(i,j,k) << endl;
cout << "Values of i, j, and k after the call to f2 are: "
<< i << ", " << j << ", and " << k << endl << endl;
cout << "f3(i,j,k) = " << f3(i,j,k) << endl;
cout << "Values of i, j, and k after the call to f3 are: "
<< i << ", " << j << ", and " << k << endl;
}
int f1 (int x, int y, int z)
{
x=x+5;
y=y+5;
z=z+5;
return(x+y+z);
}
int f2 (int& x, int& y, int& z)
{
x=x+5;
y=y+5;
z=z+5;
return(x+y+z);
}
int f3 (int x, int& y, int z)
{
x=x+5;
y=y+5;
z=z+5;
return(x+y+z);
}
No comments:
Post a Comment