Thanks for the prompt reply. I must have something else in there affecting it then, because when I enter any negative number, the program still functions as if nothing is wrong. Here is my program (again, I'm new at C, so I'm sure some of the coding isn't optimal).
#include <stdio.h>
#include <stdlib.h>
main()
{
//Define the Variables and their Values
float fltDelMar = .0725f; //Defines Del Mar's tax percentage
float fltEncinitas = .075f; //Defines Encinitas' tax percentage
float fltLaJolla = .0775f; //Defines La Jolla's tax percentage
float fltAmount; //Defines the sale amount
char chrPercent = '\45'; //Defines a % sign for usage in the program
char chrEqual = '\75'; //Defines an = sign for usage in the program
char chrColon = '\72'; //Defines a : sign for usage in the program
int ui; //Defines an integer to hold the scanf function for user input to be verfied
//Displays what the program is and what it will do
printf("Kudler Fine Foods Tax Calculator\n");
printf("\nThis program will calculate the tax amount that should be added to each sale\n based on the following locations and their appropriate tax rates. \nIt will also provide the total amount for the transaction.\n");
printf("\nDel Mar - 7.25%c tax rate", chrPercent);
printf("\nEncinitas - 7.5%c tax rate", chrPercent);
printf("\nLa Jolla - 7.75%c tax rate\n", chrPercent);
//Allows the user to enter an amount to be taxed
printf("\nPlease enter the total purchase amount in dollars and cents, then press [ENTER]:\n");
ui = scanf("%f",&fltAmount);
fflush(stdin);
if (ui <= 0)
{
printf("That is not a valid purchase amount.\n");
}
else
{
//Calculates the tax rates as well as totals the transaction
printf("\nDel Mar%c Tax%c $%.2f, Total%c $%.2f\n", chrColon, chrEqual, fltDelMar * fltAmount, chrEqual, (fltDelMar * fltAmount) + fltAmount);
printf("\nEncinitas%c Tax%c $%.2f, Total%c $%.2f\n", chrColon, chrEqual, fltEncinitas * fltAmount, chrEqual, (fltEncinitas * fltAmount) + fltAmount);
printf("\nLa Jolla%c Tax%c $%.2f, Total%c $%.2f\n", chrColon, chrEqual, fltLaJolla * fltAmount, chrEqual, (fltLaJolla * fltAmount) + fltAmount);
}
//Requires the user to press [ENTER] to exit the program
printf("\nThank you for using the tax calculator!");
printf("\nPress [ENTER] to exit the program...");
getch();
}