C新手和將要學習它,所以我可以開發強大的基礎知識,所以我決定在這裏註冊。感謝您的高級幫助。我的代碼有什麼問題 - 它在最後的printf()
行上崩潰了?在管線爲什麼此代碼在運行時崩潰?
#include <stdio.h>
main(int argc, char *argv[])
{
// car loan calculator
int carPrice, carDownPayment, loanTerm;
float loanInterestRate, salesTax;
printf("What is the price of the car? ");
scanf("%d", &carPrice);
printf("How much down payment do you have? ");
scanf("%d", &carDownPayment);
printf("What is your loan's interest rate? ");
scanf("%f", &loanInterestRate);
printf("What is your sales tax? ");
scanf("%f", &salesTax);
printf("What is your loan term? ");
scanf("%d", loanTerm);
printf("The price of the car is %d. Your down payment is %d. Your loan interest rate is %1f. Sales tax is %2f. Your loan term is %d.", carPrice, carDownPayment, loanInterestRate, salesTax, loanTerm);
float monthlyPayment;
printf("Your monthly should be about %3.2f dollars over a term of %d months."), (carPrice * salesTax * loanInterestRate - carDownPayment/loanTerm), loanTerm;
return 0;
}
什麼是你的代碼錯誤? – Danh
它嘗試打印最終計算的行崩潰。 –
'的printf( 「你每月應約3.2F%美元,比的%d個月的監禁。」(carPrice *銷售稅* loanInterestRate - carDownPayment/loanTerm),loanTerm);' – Danh