+ 1
Helpe to solve this?
package main import "fmt" //create the route() function func main() { var n int fmt.Scanln(&n) var cities []string //take n strings as input and append them to the slice // route(cities...) }
1 Resposta
0
package main
import "fmt"
// create the route() function
func route(cities ...string) {
// perform routing logic using the cities slice
fmt.Println("Routing:", cities)
}
func main() {
var n int
fmt.Scanln(&n)
var cities []string
for i := 0; i < n; i++ {
var city string
fmt.Scanln(&city)
cities = append(cities, city)
}
route(cities...)
}