Académique Documents
Professionnel Documents
Culture Documents
#include <iostream>
using namespace std;
int x, square;
int SquarebyValue(int x)
{
return x*x;
}
void SquareByReference(int &y)
{
y *= y;
cout << "Square of x is: " << y << endl;
}
int main()
{
cout << " enter the value which you want to square:" << endl;
cin >> x;
cout << "Value of x before squaring is: " << x << endl;
square = SquarebyValue(x);
cout << "Value of x after squaring is: " << x << "Square of that number is: " << square
<< endl;
cout << "Value of x before squaring is: " << x << endl;
SquareByReference(x);
cout << "Value of x after squaring is: " << x << endl;