问题描述
有谁可以告诉我为什么不能编译?
#include< stdio.h>
#include< ctype.h>
void main()
{
/ *使用相应税率定义的变量。 * /
float fTaxRateDelMar = .0725;
float fTaxRateEncinitas = .075;
float fTaxRateLaJolla = .0775;
/ *为用户计算的变量为要征税的美元金额定义。* /
float fDollarAmount = 0.0;
printf(" \\\
Welcome to Kudler Fine Foods.\\\
;
printf(\ n请输入要征税的小计:);
scanf("%f" ;,& fDollarAmount);
/ *检查用户输入的有效性(数字) - 如果输入无效则返回,如果输入有效则继续* /
int i = isdigit(fDollarAmount);
而i == 0
{
printf(" \\\
Please输入有效数字:");
scanf("%f"& fDollarAmount);
int i = isdigit(fDollarAmount);
}
/ *计算变量定义和计算完成。 * /
float fSalesTaxDelMar = fDollarAmount * fTaxRateDelMar;
float fSalesTaxEncinitas = fDollarAmount * fTaxRateEncinitas;
float fSalesTaxLaJolla = fDollarAmount * fTaxRateLaJolla;
float fTotalSaleDelMar = fDollarAmount + fSalesTaxDelMar;
float fTotalSaleEncinitas = fDollarAmount + fSalesTaxEncinitas;
float fTotalSaleLaJolla = fDollarAmount + fSalesTaxLaJolla;
/ *打印报表以显示销售税和总销售额。 * /
printf(\ n在Del Mar商店的$%i的销售税为:$%。2f\ n,fDollarAmount,fSalesTaxDelMar);
printf(\ n恩西尼塔斯商店$%i的销售税为:$%。2f\ n,fDollarAmount,fSalesTaxEncinitas);
printf(" \\\
The La Jolla商店$%i的销售税为:$%。2f\ n,fDollarAmount,fSalesTaxLaJolla);
}
的销售税>
Can anyone tell me why this won''t compile?
#include <stdio.h>
#include <ctype.h>
void main ()
{
/* Variables defined with corresponding tax rates. */
float fTaxRateDelMar = .0725;
float fTaxRateEncinitas = .075;
float fTaxRateLaJolla = .0775;
/* Variable defined for user inputed dollar amount to be taxed.*/
float fDollarAmount = 0.0;
printf("\nWelcome to Kudler Fine Foods.\n");
printf("\nPlease enter the subtotal to be taxed: ");
scanf ("%f", &fDollarAmount);
/* Check validity of user input (number) - return if input is invalid, continue if input is valid */
int i = isdigit(fDollarAmount);
while i==0
{
printf("\nPlease enter a valid number: ");
scanf ("%f", &fDollarAmount);
int i = isdigit(fDollarAmount);
}
/* Calculation variables defined and calculations accomplished. */
float fSalesTaxDelMar = fDollarAmount * fTaxRateDelMar;
float fSalesTaxEncinitas = fDollarAmount * fTaxRateEncinitas;
float fSalesTaxLaJolla = fDollarAmount * fTaxRateLaJolla;
float fTotalSaleDelMar = fDollarAmount + fSalesTaxDelMar;
float fTotalSaleEncinitas = fDollarAmount + fSalesTaxEncinitas;
float fTotalSaleLaJolla = fDollarAmount + fSalesTaxLaJolla;
/* Print statements to display the Sales Tax and Total Sale values. */
printf("\nThe sales tax on $%i at the Del Mar store is: $%.2f\n", fDollarAmount, fSalesTaxDelMar);
printf("\nThe sales tax on $%i at the Encinitas store is: $%.2f\n", fDollarAmount, fSalesTaxEncinitas);
printf("\nThe sales tax on $%i at the La Jolla store is: $%.2f\n", fDollarAmount, fSalesTaxLaJolla);
}
这篇关于Parce错误帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!