I'm working with a simple do, if, else, while loop. At the end I'm trying to include a total amount counter for all of the sales in a category. I know how to do a counter with one at a time but adding more than one at a time has been whipping my butt. here is the code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
string damageType;
float OriginalSalesPrice, discAmount, finalSalesPrice, originalPricetotal=0, disctotalAmount=0;
int slightDamageTotal=0, MajorDamageTotal=0, code;
char resp;
do
{
cout << left << setprecision(2) << fixed;
cout << setw(30) << "Please enter original price ";
cin >> setw(30) >> OriginalSalesPrice;
cout << setw(30) << "Please enter damage code \n"
"1. Slight Damage \n"
"2. Major Damage \n";
cin >> setw(30) >> code;
if
(code==1)
{
damageType="Slight Damage";
discAmount=OriginalSalesPrice*.10;
slightDamageTotal=slightDamageTotal+1;
}
else
if
(code==2)
{
damageType="Major Damage";
discAmount=OriginalSalesPrice*.50;
MajorDamageTotal=MajorDamageTotal+1;
}
finalSalesPrice=OriginalSalesPrice-discAmount;