Answer:
Explanation:
The solution is written in c++.
Firstly, create a struct type Point with two double fields, x and y (Line 5 - 8).
Create a function getR that accept a Point type object (Line 10). This function will calculate the distance from origin by applying the formula and then return distance (Line 11 - 12).
In main program, we create a Point object, p1, (Line 17 -19) and test the function by passing the p1 object as argument (Line 21). We shall get the sample output 5.