Witam,
czy ktoś może podpowiedzieć mi na co mam zwrócić uwagę szukając rozwiązania błędu logicznego? Próbowałam już na wiele sposobów, jednak nadal wychodzi mi podatek całkowity równy zeru, natomiast cena brutto się zaokrągla... bardzo proszę o pomoc.
//-----------------------------------------------------------------
// void priceCalculation()
//
// Summary: Reads price and number of articles from user. Calculates and prints
// quantity, vat and price with vat
// Returns: -
//-----------------------------------------------------------------
void priceCalculation()
{
// Define and initialize constants and variables
const int RATE = 25; // tax rate in percent
double price = 0; // price per piece
int nrOfArticles = 0; // number of articles
double rateEUR = 0; // tax rate in EUR
double totalPrice = 0; // price incl. tax rate
// Read price and number of articles
cout << "Enter the price excl. the tax rate: ";
cin >> price;
cout << "Enter the number of articles: ";
cin >> nrOfArticles;
// Calculate total price and tax rate
rateEUR = totalPrice * RATE;
totalPrice = nrOfArticles * price *(1 + RATE);
// Display result with 2 decimals
cout << fixed << showpoint << setprecision(2);
cout << nrOfArticles << " number of articles cost " << totalPrice << " euro. "
<< endl << "Of this " << rateEUR << " euro is the tax rate." << endl;
}