上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 44 下一页
摘要: package main import ( "fmt" "net/http" "strings" ) func main(){ reader := strings.NewReader("hello") req, _ := http.NewRequest(http.MethodGet,"http:// 阅读全文
posted @ 2022-02-27 13:49 ty1539 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 package main import ( "fmt" "math/rand" "time" ) /* 冒泡排序 */ func bubbleSortInts(a []int, sortOrder func(int,int) bool) { length := len(a) for t 阅读全文
posted @ 2022-02-27 13:46 ty1539 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 多个fmt.Scanf()输入方式: Please Input Str: Please Input Substr: str=asdfsadfadsafdfddsfsad,substr=d 输出:2 21 点击查看代码 package main import ( "fmt" "strings" ) f 阅读全文
posted @ 2022-02-27 13:16 ty1539 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 1,判断开头strings.HasPrefix(url, "https://") 点击查看代码 package main import ( "fmt" "strings" ) func urlProcess(url string) string { if !strings.HasPrefix(url 阅读全文
posted @ 2022-02-27 13:05 ty1539 阅读(635) 评论(0) 推荐(0) 编辑
摘要: 输入方式: 111空格222,多个fmt.Scanf()即使不是紧挨着,也要用空格,分隔开的,为啥会这样,还没搞清楚 点击查看代码 package main import ( "fmt" "math/big" ) //输入方式: 111空格222,多个fmt.Scanf()即使不是紧挨着,也要用空格 阅读全文
posted @ 2022-02-27 13:01 ty1539 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 点击查看代码 package main import ( "bufio" "fmt" "os" ) func main() { var str string buff := bufio.NewReader(os.Stdin) str, _ = buff.ReadString('\n') str = 阅读全文
posted @ 2022-02-27 12:57 ty1539 阅读(68) 评论(0) 推荐(0) 编辑
摘要: package main import "fmt" func isPalindromeStr(str string) bool { stop := len(str) / 2 for i := 0; i <= stop; i++ { if str[i] != str[len(str) - i - 1] 阅读全文
posted @ 2022-02-27 12:47 ty1539 阅读(125) 评论(0) 推荐(0) 编辑
摘要: /* Go 程序的基本结构 */ /* Go 程序的基本结构 */ package main import "fmt" type Moon struct { stock int } func main(){ var N,Need int var List [] Moon // var MaxSale 阅读全文
posted @ 2022-02-26 23:52 ty1539 阅读(69) 评论(0) 推荐(0) 编辑
摘要: Day02 D:\GoPath\src\MyProject\oldboy-go-course-master ### 文件名、关键字、标识符 1. 所有 go 源码以 .go 结尾 2. 标识符以字母或下划线开头,大小写敏感。 3. _ 是特殊标识符,用来忽略结果。 4. 保留关键字 - break 阅读全文
posted @ 2022-02-26 23:45 ty1539 阅读(21) 评论(0) 推荐(0) 编辑
摘要: go的随机数,大多时候要用rand.Seed(time.Now().UnixNano())才会有变化,但是此次不用也没事,具体详情没搞清楚 package main import ( "fmt" "math/rand" "time" ) func init() { rand.Seed(time.No 阅读全文
posted @ 2022-02-26 23:42 ty1539 阅读(55) 评论(0) 推荐(0) 编辑
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 44 下一页