1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
| package main
import "fmt"
func main041() { fmt.Println("请输入你的出生月份(1-12)") var month int fmt.Scan(&month) fmt.Printf("month=%d", month)
switch month { case 1: fmt.Printf("你大概率是%s座\n", "摩羯") case 2: fmt.Printf("你大概率是%s座\n", "水瓶") case 3: fmt.Printf("你大概率是%s座\n", "双鱼") case 4: fmt.Printf("你大概率是%s座\n", "白羊") case 5: fmt.Printf("你大概率是%s座\n", "金牛") case 6: fmt.Printf("你大概率是%s座\n", "双子") case 7: fmt.Printf("你大概率是%s座\n", "巨蟹") case 8: fmt.Printf("你大概率是%s座\n", "狮子") case 9: fmt.Printf("你大概率是%s座\n", "处女") case 10: fmt.Printf("你大概率是%s座\n", "天平") case 11: fmt.Printf("你大概率是%s座\n", "天蝎") case 12: fmt.Printf("你大概率是%s座\n", "射手")
default: fmt.Println("你就是传说中的蛇夫座") } }
func main042() { fmt.Println("请输入你的出生月份(1-12)") var month int fmt.Scan(&month)
switch month { case 12, 1, 2: fmt.Println("你出生在冬天") case 3, 4, 5: fmt.Println("你出生在春天") case 6, 7, 8: fmt.Println("你出生在夏天") case 9, 10, 11: fmt.Println("你出生在秋天") default: fmt.Println("你出生在火星") } }
func main043() { fmt.Println("请输入你的出生月份(1-12)") var month int fmt.Scan(&month)
switch { case month >= 3 && month <= 5: fmt.Println("你出生在春天") case month >= 6 && month <= 8: fmt.Println("你出生在夏天") case month >= 9 && month <= 11: fmt.Println("你出生在秋天") case month == 12 || month == 1 || month == 2: fmt.Println("你出生在冬天") default: fmt.Println("你出生在火星") } }
func main044() { fmt.Println("请输入你的出生月份(1-12)") var month int fmt.Scan(&month)
switch { case month >= 3 && month <= 5: fmt.Println("你出生在春天") fallthrough case month >= 6 && month <= 8: fmt.Println("你出生在夏天") fmt.Println("我们出生在上半年")
case month >= 9 && month <= 11: fmt.Println("你出生在秋天") fallthrough case month == 12 || month == 1 || month == 2: fmt.Println("你出生在冬天") fmt.Println("我们出生在下半年")
default: fmt.Println("你出生在火星") } }
|