karlycaramelo / HOC

0 stars 0 forks source link

fmt.Printf() #2

Open canek-pelaez opened 5 years ago

canek-pelaez commented 5 years ago

Sueles hacer esto [1]:

fmt.Print("Porcentaje Aceptados: ")
fmt.Print(FloatToString(float64(c)/float64(ene)))   
fmt.Print("\n")

Go tiene Printf() implementado en fmt, puedes hacer lo mismo haciendo:

fmt.Printf("Porcentaje Aceptados: %2.9f\n", float64(c)/float64(ene))

Y tu código es mucho más legible.

[1] https://github.com/karlycaramelo/HOC/blob/master/go/tsp.go#L313