Вам нужно передать свои переменные по ссылке, что означает
void trans(double x,double y,double theta,double &m,double &n) { ... }
вид пакет обеспечивает стандартные блоки, если Ваша часть отсортирована, или Вы готовы отсортировать его.
input := []string{"bird", "apple", "ocean", "fork", "anchor"}
sort.Strings(input)
fmt.Println(contains(input, "apple")) // true
fmt.Println(contains(input, "grow")) // false
...
func contains(s []string, searchterm string) bool {
i := sort.SearchStrings(s, searchterm)
return i < len(s) && s[i] == searchterm
}
SearchString
обещания возвратиться the index to insert x if x is not present (it could be len(a))
, таким образом, проверка этого показывает, содержится ли строка отсортированная часть.
Стиль движения:
func Contains(n int, match func(i int) bool) bool {
for i := 0; i < n; i++ {
if match(i) {
return true
}
}
return false
}
s := []string{"a", "b", "c", "o"}
// test if s contains "o"
ok := Contains(len(s), func(i int) bool {
return s[i] == "o"
})