The first function must be responsible for inputting the data, the second for computation of squares and the third, for Displaying the result.
void EnterSqrt(int i)
{
cout << "Enter square num:" << endl;
cin >> i;
}
int CompSqrt(int f)
{
EnterSqrt(f);
return f * f;
}
void PrintSqrt(int j)
{
cout << CompSqrt(j) << endl;
}
int main()
{
int num;
EnterSqrt(num);
CompSqrt(num);
PrintSqrt(num);
}
Comments
Leave a comment