package main

import (
	"fmt"
	"os"
	"strconv"
)

const exitCommand = "/q"

func main() {
	var userInput string
	fmt.Printf("Welcome to trunc.go. Please enter %s to exit the program.\n", exitCommand)
	for {
		fmt.Println("Enter a float number:")
		fmt.Scan(&userInput)

		if userInput == exitCommand {
			fmt.Println("Closing...")
			os.Exit(0)
		}

		userFloat, err := strconv.ParseFloat(userInput, 64)
		if err != nil {
			fmt.Println("Opps you entered and incorrect input! Try again.")
			continue
		}
		fmt.Printf("You entered: %f, the interger component of that is: %d\n", userFloat, int(userFloat))
	}
}
