0

write a user defined function that accepts the radius of the fountain as an argument and returns the area and circumference?

a circular fountain is situated in the center of a park. write a user defined function that accepts the radius of the fountain as an argument and returns the area and circumference of it. write a c++ program that invokes this function.🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! Code therapistRashad Malikov https://code.sololearn.com/c9Pl914w66tT/?ref=app

15th Dec 2019, 12:09 AM
malk Al-Maamari
malk Al-Maamari - avatar
8 Respuestas
+ 1
Could any one please check the requirements?
15th Dec 2019, 12:16 AM
malk Al-Maamari
malk Al-Maamari - avatar
+ 1
better define them same type float area(int x) float area(float x)
15th Dec 2019, 6:31 AM
Rashad Malikov
Rashad Malikov - avatar
+ 1
You can make the function like this Void area(float &area, float &circumference, float radius){ area=3.14*radius*radius; circumference =2*3.14*radius; } Call it by refernce for area an circumference but by value for radius
16th Dec 2019, 2:10 PM
Gamal Kassem Farouk
+ 1
Or you can use this code Return array y that contain the area and the circumference int [] areaAndCircumference(float r){ int arr[] =new int[2]; arr[0]=3.14 *r*r;//area arr[1]=2*3.14 *r;//circumference return arr; }
16th Dec 2019, 2:19 PM
Gamal Kassem Farouk
0
It seems correct, so there's no point making it a question
15th Dec 2019, 12:51 AM
Dlite
Dlite - avatar
0
DLite First, thanks for replaying...I feel there is something missing
15th Dec 2019, 1:50 AM
malk Al-Maamari
malk Al-Maamari - avatar
0
Rashad Malikov thank you
15th Dec 2019, 9:48 AM
malk Al-Maamari
malk Al-Maamari - avatar
0
because if user input decimal value it will lose data
15th Dec 2019, 9:49 AM
Rashad Malikov
Rashad Malikov - avatar