- 1
How to create in c++ Using Functions.....anyone?
1. write a function that calculates and returns area of a circle for a given radius 2. write a function that calculates and returns the cost of tiling a circle region for given radius and cost of tiles per unit area 3. write a function that calculates and returns the cost of tiling a circle region that have a square grassy plot for given radius, length of square and cost of tiles
1 Answer
+ 2
1. float area(int radius)
{ return radius*radius*3.14;
}
2.float cost(float cpt, int rad) //cpt is cost per area
{ return cpt*area(rad);
}
3. here square part will be subtracted.
float netcost(float cp,int r,int s)
{ return cost(cp,r)-cp*s*s;
}