mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 22:00:03 +08:00
32 lines
665 B
Go
Executable File
32 lines
665 B
Go
Executable File
// minmain.go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"./min"
|
|
)
|
|
|
|
func ints() {
|
|
data := []int{74, 59, 238, -784, 9845, 959, 905, 0, 0, 42, 7586, -5467984, 7586}
|
|
a := min.IntArray(data) //conversion to type IntArray
|
|
m := min.Min(a)
|
|
fmt.Printf("The minimum of the array is: %v\n", m)
|
|
}
|
|
|
|
func strings() {
|
|
data := []string{"ddd", "eee", "bbb", "ccc", "aaa"}
|
|
a := min.StringArray(data)
|
|
m := min.Min(a)
|
|
fmt.Printf("The minimum of the array is: %v\n", m)
|
|
}
|
|
|
|
func main() {
|
|
ints()
|
|
strings()
|
|
}
|
|
|
|
/* Output:
|
|
The minimum of the array is: -5467984
|
|
The minimum of the array is: aaa
|
|
*/
|