Esempio n. 1
0
func main() {
	for _, arg := range os.Args[1:] {
		t, err := strconv.ParseFloat(arg, 64)
		if err != nil {
			fmt.Fprintf(os.Stderr, "cf: %v\n", err)
			os.Exit(1)
		}
		f := tempconv.Fahrenheit(t)
		c := tempconv.Celsius(t)
		fmt.Printf("%s = %s, %s = %s\n",
			f, tempconv.FToC(f), c, tempconv.CToF(c))
	}
}
Esempio n. 2
0
func main() {
	fmt.Println("begin")
	var s = []string{"32", "212"}
	for _, arg := range s[0:] {
		t, err := strconv.ParseFloat(arg, 64)
		if err != nil {
			fmt.Fprintf(os.Stderr, "cf: %v\n", err)
			os.Exit(1)
		}
		f := tempconv.Fahrenheit(t)
		c := tempconv.Celsius(t)
		fmt.Printf("%s = %s, %s = %s\n",
			f, tempconv.FToC(f), c, tempconv.CToF(c))
	}
}
Esempio n. 3
0
func othercrap() {
	f := tempconv.Fahrenheit(23)
	fmt.Fprintf(os.Stderr, "cf: %v\n", f)
	fmt.Fprintf(os.Stderr, "Freezing temp is %v\n", tempconv.FreezingC)
	fmt.Fprintf(os.Stdout, "celsius: %v\n", tempconv.FToC(f))
	HTTPClient = http.DefaultClient
	req, err := http.NewRequest("GET", "http://www.standyck.com", nil)
	if err != nil {
		fmt.Fprintf(os.Stdout, "err: %v\n", err)
	} else {
		r, _ := HTTPClient.Do(req)
		fmt.Fprintf(os.Stdout, "req: %v\n", req)
		fmt.Fprintf(os.Stdout, "response: %v\n", r)
	}

	z := popcount.PopCount(19235)
	fmt.Printf("popcount: %v\n", z)
}
Esempio n. 4
0
func unitconv(param float64) (c tempconv.Celsius, mt meter, kg kgram) {
	c = tempconv.FToC(tempconv.Fahrenheit(param))
	mt = feetToMeter(feet(param))
	kg = poundToKg(pound(param))
	return c, mt, kg
}