dimanche 28 juin 2020

Need assistance with this if statement

first, let let me show you the code:

    // calculate grand total
if(unitsPurchased >= 10,19)
{
    discount = .20;
    totalCost = totalCost - (totalCost * discount);
    cout << fixed << setprecision(2);
    cout << "\tBecuase you purchased " << unitsPurchased << " Units,\n\tYou get a 20% discount!" << "The grand total is: $" << totalCost << endl;
}

I'm trying to apply a 20% discount if a person buys between 10 to 19 items. how can I alter my if statement to reflect this? I've tried using AND (&&) but that didn't work. how can I set the range between two numbers?

Aucun commentaire:

Enregistrer un commentaire