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
8 odpowiedzi
+ 1
Could any one please check the requirements?
+ 1
better define them same type
float area(int x)
float area(float x)
+ 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
+ 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;
}
0
It seems correct, so there's no point making it a question
0
DLite First, thanks for replaying...I feel there is something missing
0
Rashad Malikov thank you
0
because if user input decimal value it will lose data