Esempio n. 1
0
func main() {
	c := tempconv.FreezingC
	fmt.Println("Freezing Celsius:", c)
	fmt.Println("C(0˚C) to F:", tempconv.CToF(c))
	fmt.Println("C(0˚C) to K:", tempconv.CToK(c))
	fmt.Println("C(20˚C) to F:", tempconv.CToF(c+20))
	fmt.Println("F(0˚F) to C:", tempconv.FToC(0))
	fmt.Println("F(32˚F) to C:", tempconv.FToC(32))
}
Esempio n. 2
0
func printConvertedValue(t float64) {
	// Fahrenheit <=> Celsius
	f := tempconv.Fahrenheit(t)
	c := tempconv.Celsius(t)
	fmt.Printf("%s = %s, %s = %s\n",
		f, tempconv.FToC(f), c, tempconv.CToF(c))

	// Feet <=> Meter
	ft := tempconv.Feet(t)
	m := tempconv.Meter(t)
	fmt.Printf("%s = %s, %s = %s\n",
		ft, tempconv.FtToM(ft), m, tempconv.MToFt(m))

	// Pound <=> Kilogram
	lb := tempconv.Pound(t)
	kg := tempconv.Kilogram(t)
	fmt.Printf("%s = %s, %s = %s\n",
		lb, tempconv.LbToKg(lb), kg, tempconv.KgToLb(kg))
}