// Mr. Minich
// Comp Sci Using C++
// Ch. 4 Demo Program #2
// January 30, 2000
// Purpose - to illustrate the dangers of not initializing variables when declaring them
#include <iostream.h>
int main()
{
const double PA_SALES_TAX = 0.06; // the PA sales tax rate
double price = 0.0; // price of a purchase
int quantity = 0; // the quantity of items purchased
double totalCost; // the total cost of a purchase
// Three variables and one constant are declared above.
// price and quantity are initialized but totalCost is not.
// Therefore totalCost currently holds a garbage value. It is not automatically
// initialized to the value of zero by C++ as you might assume.
cout << "The price is $" << price << "." << endl;
cout << "The quantity is " << quantity << "." << endl;
cout << "The PA sales tax rate is " << PA_SALES_TAX << "." << endl;
cout << "The total cost is " << totalCost << "." << endl;
// totalCost will be displayed as a garbage value.
return 0;
}// end of main