package main
import (
"fmt"
"math"
)
func main() {
distencecalc()
}
func distencecalc() {
fmt.Println("X1 :")
var x1 float64
fmt.Scanf("%f", &x1)
fmt.Print("")
fmt.Println("Y1 :")
var y1 float64
fmt.Scanf("%f", &y1)
fmt.Print("")
fmt.Println("Z1 :")
var z1 float64
fmt.Scanf("%f", &z1)
fmt.Print("")
fmt.Println("X2 :")
var x2 float64
fmt.Scanf("%f", &x2)
fmt.Print("")
fmt.Println("Y2 :")
var y2 float64
fmt.Scanf("%f", &y2)
fmt.Print("")
fmt.Println("Z2 :")
var z2 float64
fmt.Scanf("%f", &z2)
fmt.Print("")
var Xcalc = x2 - x1
var Ycalc = y2 - y1
var Zcalc = z2 - z1
var calcX = math.Pow(Xcalc, 2)
var calcY = math.Pow(Ycalc, 2)
var calcZ = math.Pow(Zcalc, 2)
var allcalc = calcX + calcZ + calcY
fmt.Println("the result is :")
fmt.Println(math.Sqrt(allcalc))
}
The problem is I compile then run the program it asks about x1 I enter the value and it asks about y1 and z1 at the same time.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…