2013-05-29 4 views
0

안녕하세요 저는 작은 기본 언어를 사용하기 시작했으며 컴파일 된 간단한 프로그램이 있지만 뭔가 잘못되었습니다.스몰 베이직 : 내가 뭘 잘못 했니?

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 

답변은 항상 0입니다. 숫자를 "Total"로 설정하려고하면 작동합니다. 예 :

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 

답변

2

당신은 '대출'의 값을 사용하고, 'Loanp', 당신이 읽을 전에 SalaryExpense (Total을 계산하기 위해)! 예를 들어, Salary = TextWindow.ReadNumber() 다음과 같이 값을 읽는 행 다음으로 계산 된 행을 Total으로 이동해야합니다.

+0

반갑습니다. 도움이 되었다면 답을 수락하십시오. – Gian

+0

나는 미안 투표를하지 않았다 (평판이 15 점 미만) – user2433191

관련 문제