### I need help with a do while!

Alright I have a program that needs to calculate different rates of commission for a particular sale

I'm stuck in a loop and I'm not sure how to update the final cout statements as well.

 ``1234567891011121314151617181920212223242526272829303132333435`` ``````#include #include using namespace std; int main() { //declare variables double sales = 0.0; double commission = 0.0; double rate =.05; //set up do while loop do { cout << "Enter the sales amount: \$"; cin >> sales; //calculation commission = sales * rate; //set increment to increase by one each time rate+.05; cout << rate * 100 << "% commission: \$" << commission << endl; } while (rate <= .25);//end while at last bracket system ("pause"); return 0; }//end main ``````

The program should look like this at the end

Enter the sales: 25000
10% commission: \$2500
15% commission: \$3750
20% commission: \$5000
25% commission: \$6250
Press any key to continue..._

and yes those are the actual rates i need to calculate and they are in increments of 5%

Thanks to whoever replies ;O
 ``1234567891011121314151617181920212223242526272829303132`` ``````#include #include using namespace std; int main() { //declare variables double sales = 0.0; double commission = 0.0; double rate =.10; //set up do while loop cout << "Enter the sales amount: \$"; cin >> sales; do { //calculation commission = sales * rate; //set increment to increase by one each time cout << rate * 100 << "% commission: \$" << commission << endl; rate = rate +.05; } while (rate <= .25);//end while at last bracket system ("pause"); return 0; }``````
I did and there's no difference. The program will calculate and display the 10% commission but that one only
It should be like this.
 ``123456789101112131415161718192021222324252627282930313233`` ``````#include #include using namespace std; int main() { //declare variables double sales = 0.0; double commission = 0.0; double rate =.1; //set up do while loop cout << "Enter the sales amount: \$"; cin >> sales; do { //calculation commission = sales * rate; //set increment to increase by one each time rate = rate +.05; cout << rate * 100 << "% commission: \$" << commission << endl; } while (rate <= .25);//end while at last bracket return 0; }``````
THANK YOU.

however i did have to change the double rate to .05 instead of .1 but it works perfectly! Here's the final product.

 ``12345678910111213141516171819202122232425262728293031323334`` ``````#include #include using namespace std; int main() { //declare variables double sales = 0.0; double commission = 0.0; double rate =.05; //ask for sales amount cout << "Enter the sales amount: \$"; cin >> sales; //set up do while loop do { //calculation commission = sales * rate; //set increment to increase by one each time rate = rate + 0.05; //display commission cout << rate * 100 << "% commission: \$" << commission << endl; } while (rate <= .25);//end while at last bracket system ("pause"); return 0; }//end main ``````

Once again, thank you. I was stuck on that for a while.
Topic archived. No new replies allowed.