How do i write the formula for calculating the total sales and average for this program:
[code=cpp]
while (sales !=-1)
{
i <= 12; i++;
cout << fixed << setprecision(2) << "Please enter your sales for month " << i << ": ";
cin >> sales;
} //end while
i <= 12; i--;
cout << "For " << i++ << " months: ";
cout << fixed << setprecision(2) << "Total sales: $ " << totalSales << endl;
cout << fixed << setprecision (2) << "Average sales: $ " << average << endl;
[/code]
Can someone help me if I'm doing the right thing here because it is giving some kind of warning but dont know why. Please help!
[code=cpp]
while (sales !=-1)
{
i <= 12; i++;
cout << fixed << setprecision(2) << "Please enter your sales for month " << i << ": ";
cin >> sales;
} //end while
i <= 12; i--;
cout << "For " << i++ << " months: ";
cout << fixed << setprecision(2) << "Total sales: $ " << totalSales << endl;
cout << fixed << setprecision (2) << "Average sales: $ " << average << endl;
[/code]
Can someone help me if I'm doing the right thing here because it is giving some kind of warning but dont know why. Please help!
Comment