added: new file go/l10.go and its binary version go/output/l10 for counting vowels in the first phrase and outputting the first and second phrases

This commit is contained in:
hhu67 2026-06-04 21:52:34 +03:00
parent 40c4e05f0f
commit 992fb88d6c
3 changed files with 34 additions and 1 deletions

View file

@ -3,7 +3,7 @@ strings:
.HasSuffix(x, "aaa") - для проверки оканчивается ли x на ааа(true/false)
.HasPrefix(x, "aaa") - для проверки начинается ли x на aaa(true/false)
.Contains(x, "aaa") - для проверки существует ли вообще aaa в x(true/false)
.ContainsAny(x, "abc") - для проверки есть ли в x буквы a b c
.ContainsAny(x, "abc") - для проверки есть ли в x буквы a b c(true/false)
.Count(x, "aaa") - для продсчета сколько в x aaa
.EqualFold(x, x2) - сравнивает переменные без учета их регистра
slice:

33
go/l10.go Normal file
View file

@ -0,0 +1,33 @@
package main
import (
"fmt"
"strings"
)
func polz() (string, string) {
fmt.Println("Введите первое")
var pol1 string
fmt.Scanln(&pol1)
fmt.Println("Введите второе")
var pol2 string
fmt.Scanln(&pol2)
return pol1, pol2
}
func vowel(vow string) int {
tolower := strings.ToLower(vow)
wovel := 0
for _, r := range tolower {
if strings.ContainsRune("aeiyou", r) {
wovel++
}
}
return wovel
}
func main() {
po1, po2 := polz()
fmt.Println(vowel(po1))
fmt.Println(po1, po2)
}

BIN
go/output/l10 Executable file

Binary file not shown.