help with c++ problem.
a software company sells a package that retails for $99 . Quantity discounts are given according to this table.
Quantity Discount
10-19 20%
20-49 30%
50-99 40%
100 or more 50%
Write a program that asks for the number of units sold and computes the total cost of the purchase.
Input Validation: Make sure the number of units is greater than 0.
Here is what I wrote out, tell me whats wrong with it.
#include <iostream>
using namespace std;
int main()
{
int quantity, discount, totcost, pprice;
pprice = 99;
totcost = pprice * quantity * discount;
cout << "How many units were sold? ";
cin >> quantity;
if (quantity == 10 && quantity <= 19)
discount = 20;
else if (quantity == 20 && quantity <= 49)
discount = 30;
else if (quantity == 50 && quantity <= 99)
discount = 40;
else if (quantity >= 100)
discount = 50;
else
discount = 0;
cout << "The total cost of the units is $ " << totcost
<< endl;
return 0;