1. Write a program that will illustrate the use of a function for computing the square of a number. There must be three other functions aside from main(). The First function must be responsible for inputting the data, the second for computation of squares and the third, for Displaying the result. 10 points
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