VariableAmountOfArgs
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
6
|
||||
7
|
||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
module fourth
|
||||
|
||||
go 1.24.5
|
||||
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fourth/sub"
|
||||
)
|
||||
|
||||
|
||||
func main() {
|
||||
res := sub.Kek("data.txt")
|
||||
fmt.Println(res)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package sub
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Kek(fileName string) []int {
|
||||
var seg []int
|
||||
counter := 0
|
||||
file,_ := os.Open(fileName)
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
mid,_ := strconv.ParseInt(scanner.Text(),0,0)
|
||||
seg = append(seg,int(mid))
|
||||
counter++
|
||||
}
|
||||
return seg
|
||||
}
|
||||
Reference in New Issue
Block a user