add: unfinished code. people are having problems

This commit is contained in:
Inanc Gumus
2018-11-13 17:43:25 +03:00
parent 67b20e5755
commit 490223331c
103 changed files with 4218 additions and 3 deletions

View File

@@ -0,0 +1,41 @@
package main
import (
"fmt"
"os"
"strconv"
)
const usage = `Sorry. Go arrays are fixed.
So, for now, I'm only supporting sorting %d numbers...
`
func main() {
args := os.Args[1:]
var nums [5]float64
if len(args) > 5 {
fmt.Printf(usage, len(nums))
return
}
for i, v := range args {
n, err := strconv.ParseFloat(v, 64)
if err != nil {
continue
}
nums[i] = n
}
for range nums {
for i, v := range nums {
if i < len(nums)-1 && v > nums[i+1] {
nums[i], nums[i+1] = nums[i+1], nums[i]
}
}
}
fmt.Println(nums)
}