我一直在尝试在另一个函数中创建一个函数,其中getPoolInfo的输出将为(Func1:Double,Func2:Double)。
我真的需要你的帮助。
func getPoolInfo(PoolLength:Double, PoolWidth:Double, ShallowDepth:Double,DeepDepth:Double)->(Double,Double)
{
//To calculate the Area of the Pool
func Area(PoolLength:Double,PoolWidth:Double)-> Double
{
let area = PoolLength * PoolWidth
return area
}
//To calculate the Volume of the Pool
func poolVolume(PoolLength:Double, PoolWidth:Double, ShallowDepth:Double,DeepDepth:Double)->Double{
let area = PoolLength * PoolWidth
let avgDepth = ((ShallowDepth + DeepDepth) / 2)
let volume = area * avgDepth
return volume
}
return (Area(),poolVolume())
}
getPoolInfo(PoolLength:12,PoolWidth:6,ShallowDepth:1,DeepDepth:3)
缺少参数的参数
答案 0 :(得分:0)
更改
return (Area(),poolVolume())
到
return (Area(PoolLength:PoolLength,PoolWidth:PoolWidth),poolVolume(PoolLength:PoolLength, PoolWidth:PoolWidth, ShallowDepth:ShallowDepth,DeepDepth:DeepDepth))