您好我刚刚开始使用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
答案 0 :(得分:2)
在您阅读之前,您正在使用“贷款”,“贷款”,Salary
和Expense
(计算Total
)的值!您需要将计算Total
的行移到您读取值的行之后的某个位置,例如Salary = TextWindow.ReadNumber()
之后。