Compare commits

..

No commits in common. "24f0adac097b50f64862808d455dcbd4f65d313e" and "e7f5cec04cad13d79b3ad16022060cc59ce22055" have entirely different histories.

3 changed files with 31 additions and 34 deletions

0
golangr/array/LICENSE Normal file
View File

View File

@ -2,9 +2,9 @@ package main
import (
"fmt"
"log"
"os"
//"time"
"time"
//"log"
)
var notas []float64
@ -13,6 +13,7 @@ var choice int
func main() {
fmt.Print("\033[H\033[2J")
fmt.Printf("Welcome to the vector playground\n\n")
msg()
options()
@ -20,14 +21,7 @@ func main() {
func options() {
for {
if _, err := fmt.Scanln(&choice); err != nil {
log.Print("Something failed")
}
if choice == 0 {
return
}
fmt.Scanln(&choice)
switch choice {
case 1:
@ -49,8 +43,6 @@ func options() {
}
// There is no saving this codebase, it has become so convoluted I can barely comprehend anything anymore
func msg() {
fmt.Print("\033[H\033[2J")
fmt.Printf("[1] Add to vector\n")
@ -69,35 +61,19 @@ func addVec() {
} else {
msg()
fmt.Printf("\nERROR: Invalid number\nChoice: ")
fmt.Println("\nERROR: Invalid number")
return
}
notas = append(notas, num)
//time.Sleep(2 * time.Second)
//time.Sleep(2 * time.Second)
fmt.Printf("You have added the number %v!", num)
time.Sleep(2 * time.Second)
msg()
fmt.Printf("\nYou have added the number %v!\nChoice: ", num)
num = 0
}
func showResults() {
//time.Sleep(2 * time.Second)
fmt.Printf("These are your current grades: \n")
fmt.Print(notas)
time.Sleep(2 * time.Second)
msg()
min := notas[0]
max := notas[0]
for _, v := range notas {
if v < min {
min = v
}
}
for _, v := range notas {
if v > max {
max = v
}
}
fmt.Printf("\nThese are your current grades: \n")
fmt.Printf("%.2f\n", notas)
fmt.Printf("Lowest grade: %v\n", min)
fmt.Printf("Highest grade: %v\n", max)
fmt.Printf("Choice: ")
}

View File

@ -4,8 +4,16 @@ package main
import (
"fmt"
//"math")
)
// This is dumb
// func roundFloat(numero float64, precision uint) float64 {
// var radio = math.Pow(10, float64(precision))
// var resultado = math.Round(numero*radio) / radio
// return resultado
// }
const IVA float64 = 1.1
const costeFijo float64 = 15.0
@ -17,6 +25,14 @@ var numeroPartidos int32
var numeroApuestas int32
func main() {
// var IVA float64 = 1.21
//
// var costeFijo float64 = 15.0
//
// var partidoExtra float64 = 6.0
//
// var numeroPartidos int32
// var numeroApuestas int32
fmt.Printf("Cuantos partidos has visto?\nNúmero: ")
fmt.Scan(&numeroPartidos)
@ -40,7 +56,12 @@ func main() {
}
var precioFinal float64 = costeFijo + impuestoPartidos + impuestoApuestas
// var precioFinalMasIVA float64 = roundFloat(precioFinal*IVA, 2)
var precioFinalMasIVA float64 = precioFinal * IVA
fmt.Printf("\nLa factura del mes costará %.2f€!\n", precioFinal)
fmt.Printf("La factura del mes incluyendo IVA costará %.2f€!\n", precioFinalMasIVA)
// OH MY LORD, I DON'T NEED A DAMN FUNCTION JUST TO ROUND NUMBERS DOWN, I CAN
// LITERALLY JUST FORMAT TO FLOAT AND WRITE .$num BETWEEN % AND f
// I am the world's biggest dumbass
}