コード例 #1
0
ファイル: main.go プロジェクト: davedash/thousand
func printChoices(answers map[string]int) {
	choices := []string{"a", "b", "c", "d"}

	sort.Strings(choices)

	// Do a multiple choice with words listed and A B C D
	for _, choice := range choices {
		text := num2words.Convert(answers[choice])
		fmt.Printf("%s.) %s \n", choice, text)
	}

	fmt.Println("q.) Quit")
}
コード例 #2
0
ファイル: main.go プロジェクト: Shenung/CSCI-130
func main() {
	letterCount := 0
	for i := 1; i <= 1000; i++ {
		str := num2words.Convert(i)
		fmt.Println(str)
		for _, r := range str {
			c := string(r)
			if c != " " || c != "-" {
				letterCount++
			}
		}
	}
	fmt.Println(letterCount)
}