0

您好,我刚开始使用 small basic,我编译了一个简单的程序,但出了点问题。

 Total = ((Loan*Loanp/100)+Expense)-Salary
TextWindow.WriteLine("Your Loan: ")
Loan = TextWindow.ReadNumber() 
TextWindow.WriteLine ("Your Loan %: ")
TextWindow.ReadNumber(Loanp)
TextWindow.WriteLine ("Your Expense: ")
Expense = TextWindow.ReadNumber()
TextWindow.WriteLine ("Your Salary: ")
Salary = TextWindow.ReadNumber()
If (Loan*Loanp/100)+Expense > Salary Then
  TextWindow.WriteLine ("Error : You are FOREVER in loan")
Else
  TextWindow.WriteLine ("You savings are "+Total)

EndIf

答案总是零。当我尝试将数字设置为“总计”时,它可以工作。

Total = 100*3/100+50
TextWindow.WriteLine("Your Loan: ")
Loan = TextWindow.ReadNumber() 
TextWindow.WriteLine ("Your Loan %: ")
TextWindow.ReadNumber(Loanp)
TextWindow.WriteLine ("Your Expense: ")
Expense = TextWindow.ReadNumber()
TextWindow.WriteLine ("Your Salary: ")
Salary = TextWindow.ReadNumber()
If (Loan*Loanp/100)+Expense > Salary Then
  TextWindow.WriteLine ("Error : You are FOREVER in loan")
Else
  TextWindow.WriteLine ("You savings are "+Total)
EndIf
4

1 回答 1

2

在读入之前,您正在使用“Loan”、“Loanp”SalaryExpense(计算)的值!Total您需要将计算的行移动Total到您读取值的行之后的某个位置,例如 after Salary = TextWindow.ReadNumber()

于 2013-05-29T15:51:36.470 回答