Write a forward declaration ie a prototype for a function th
Write a forward declaration (i.e. a prototype) for a function that takes a number as a parameter, represented as a double, and evaluates to the square root of that number.
Solution
Answer:
The forward declaration for the given function is :
\" public double sqrt(double number); \"
Forward declaration is like you declare the function first without implementing it. But you implement it in the end. Let me show you an example :
public double sqrt(double number);
public int main()
{
cout << sqrt(25);
}
public double sqrt(double number)
{
return Math.sqrt(number);
}
The first part is called forward declaration where you just declare the function, but not implement it. You implement it at the bottom after the main function.
