2024-01-19 09:03:40 +01:00
|
|
|
package main
|
|
|
|
|
2024-01-19 10:23:55 +01:00
|
|
|
// TODO: figure out colored text
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
2024-01-19 09:03:40 +01:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
var numStar int
|
|
|
|
var numShape int
|
|
|
|
|
2024-01-19 10:23:55 +01:00
|
|
|
// TODO: Add error handling for star number
|
2024-01-19 09:03:40 +01:00
|
|
|
fmt.Println("How many stars do you want?")
|
|
|
|
fmt.Printf(" Stars: ")
|
|
|
|
fmt.Scan(&numStar)
|
|
|
|
|
|
|
|
fmt.Printf("\n")
|
|
|
|
|
2024-01-19 10:23:55 +01:00
|
|
|
forShapes:
|
|
|
|
for {
|
|
|
|
fmt.Println("Which shape would you like?\n Line [1]\n Square [2]\n Flag [3]")
|
|
|
|
fmt.Printf("Shape: ")
|
|
|
|
fmt.Scanln(&numShape)
|
|
|
|
fmt.Printf("\n")
|
|
|
|
switch numShape {
|
|
|
|
case 1:
|
|
|
|
line(numStar)
|
|
|
|
break forShapes
|
|
|
|
case 2:
|
|
|
|
square(numStar)
|
|
|
|
break forShapes
|
|
|
|
case 3:
|
|
|
|
flag(numStar)
|
|
|
|
break forShapes
|
|
|
|
default:
|
|
|
|
fmt.Printf("\n[-] INVALID INPUT, please use either 1, 2 or 3.\n\n")
|
|
|
|
}
|
2024-01-19 09:03:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func line(num int) {
|
|
|
|
for i := 0; i < num; i++ {
|
|
|
|
fmt.Printf("* ")
|
|
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
func square(num int) {
|
|
|
|
for i := 0; i < num; i++ {
|
|
|
|
for i := 0; i < num; i++ {
|
|
|
|
fmt.Printf("* ")
|
|
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func flag(num int) {
|
|
|
|
for a := 0; a < num; a++ {
|
|
|
|
for i := -1; i < a; i++ {
|
|
|
|
fmt.Printf("* ")
|
|
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
for i := 0; i < num/2; i++ {
|
|
|
|
println("*")
|
|
|
|
}
|
|
|
|
}
|