Skip to content

Commit

Permalink
input "ans" to see answer directly
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoaer committed Jan 14, 2021
1 parent 7685718 commit 023bd64
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion question/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func showProblem(problem file.Problem, begin, end int) status {
var stats status = correct
var answer string
var answer, getchar string
for {
clear()
fmt.Printf("%d/%d\n", begin, end)
Expand All @@ -31,6 +31,11 @@ func showProblem(problem file.Problem, begin, end int) status {
break
} else if answer == "quit" {
return quit
} else if answer == "ans" {
fmt.Printf("答案为%s,回车继续...\n", problem.Answer)
fmt.Scanln(&getchar)
// 直接看答案当错误处理
return wrong
}
stats = wrong
}
Expand Down

0 comments on commit 023bd64

Please sign in to comment.