Documentation ¶
Overview ¶
Package tempconv performs Celsius and Fahrenheit temperature computations.
Example (One) ¶
{ //!+arith fmt.Printf("%g\n", BoilingC-FreezingC) // "100" °C boilingF := CToF(BoilingC) fmt.Printf("%g\n", boilingF-CToF(FreezingC)) // "180" °F //!-arith } /* //!+arith fmt.Printf("%g\n", boilingF-FreezingC) // compile error: type mismatch //!-arith */
Output: 100 180
Example (Two) ¶
//!+printf c := FToC(212.0) fmt.Println(c.String()) // "100°C" fmt.Printf("%v\n", c) // "100°C"; no need to call String explicitly fmt.Printf("%s\n", c) // "100°C" fmt.Println(c) // "100°C" fmt.Printf("%g\n", c) // "100"; does not call String fmt.Println(float64(c)) // "100"; does not call String //!-printf
Output: 100°C 100°C 100°C 100°C 100 100
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fahrenheit ¶
type Fahrenheit float64
Fahrenheit 华氏温度
func CToF ¶
func CToF(c Celsius) Fahrenheit
Click to show internal directories.
Click to hide internal directories.