Count variable and while loop

Hi everyone, this program should ask for deposit amount if deposit is correct then count = count + deposit. The user is then asked if the deposit amount is correct (userconfirm2), if not they can re-enter the amount and count should change to equal count + deposit2. Problem being that my while loop (tried it with if too) wont trigger when userconfirm2 == 'n'...instead it starts back at the first cout << enter deposit amount... with this code when i go back to check the account balance if the user has entered a deposit amount then entered a different amount both get stored in the count variable and give me the added values

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
else if (userOption == 'd')
{
cout << " Enter deposit amount: ";
cin >> deposit;
count=count+deposit;

while (deposit <= 0)
{cout << " ERROR: Value must be positive. Enter deposit amount:";
cin >> deposit;
}

cout << " The deposit amount is: $" << fixed << setprecision(2) << deposit << endl;
cout << " Is this correct? (y/n): ";
cin >> userConfirm2;

while (userConfirm2 == 'n') WHILE SHOULD TRIGGER
{cout << "Re enter deposit amount: ";
cin >> deposit2;
count = count + deposit2;
}

}
closed account (N36fSL3A)
What is count equal to?
count = 0;
Topic archived. No new replies allowed.