Skip to content

Inputting symbols and placeholders like £, $ and % #2

@juba666

Description

@juba666

Describe the bug
Inputting symbols and placeholders like £ , $ and % bypasses validation rules

To Reproduce
Steps to reproduce the behavior:

  1. Open cic.go and choose choice 1
  2. Input 0 for Principal Amount
  3. Input £0 for Principal Amount

Expected behavior
First input triggers error and goto pa works, second input triggers error message but doesnt goto pa, instead skips to else statement

func calcFA() {
var p float64
var s string
var n float64
var r float64
pa:
fmt.Print("Enter a Principal Amount(£): ")
fmt.Scanf("%f\n", &p)
if !(p > 0) {
        fmt.Println("ERROR: you did not enter a number greater than zero, or included a symbol")
		goto pa
} else {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions