help with simple loop bank account program

im trying to create a simple program that mimics a savings account. I'm getting stuck at the "yes/no" while loops where the program wont go to the "no" part of the program if i type "n". I'm also allowed to assume that the customer won't make a withdraw and deposit in the same month.

/*
jake lemay, block 004
program will mimic a savings account
input: initial deposit, withdraw, balance
output: new balance, interest
processing:
*/

#include<iostream>;
#include<iomanip>;
using namespace std;

int main()

{
int interestRate;
int initialDeposit;
int deposit;
int withdraw;
int balance;
int change;
int months;
char choice;
char y;
char n;


//use for, while, and do while loops each at least once!!!
cout << "what is your yearly interest rate for this account?\n"
<< "please input xx.x% ONLY in the form xx.x, not 0.xxx\n"
<< "an incorrect form will result in an incorrect rate\n"
<< "example:" << " " << "correct: 11.5" << " " << "incorrect: 0.115\n\n"
<< "interest rate: ";
cin >> setprecision(3) >> interestRate;

cout << "what is your initial deposit?: ";
cin >> initialDeposit;

if (initialDeposit < 250)
{
cout << "please deposit at least $250 into your account.\n"
<< "what is your initial deposit?\n\n"
<< "initial deposit: ";
cin >> initialDeposit;
}

else
{

balance = initialDeposit + initialDeposit*interestRate/100;

cout << "your balance is " << balance << "\n";


for (;balance >= 250;)
{
cout<< "would you like to deposit more money into this account? (y/n): ";
cin >> choice;

while (choice == y);
{
cout << "how much would you like to deposit?: ";
cin >> deposit;

change = deposit;

cout << "you currently have " << balance << " in your account.\n";

}

while (choice == n)
{
cout << "would you like to withdraw money from this account? (y/n): ";
cin >> choice;

if (choice = y)
{
cout << "how much would you like to withdraw?: ";
cin >> withdraw;

if (withdraw <= 0)
{
cout << "you must withdraw more than $1\n"
<< "how much would you like to withdraw?: ";
cin >> withdraw;
}
else
{
change = -withdraw;

if (balance < 250)
{
cout << "your balance cannot fall below $250.\n"
<< "how much would you like to withdraw?: ";
cin >> withdraw;
}
else
{
cout << "you currently have " << balance << " in your account.\n";
}

}
while (choice == n)
{
change = balance;
cout << "you currently have " << balance << " in your account.";

}

for (;months=12;)
{
cout << "would you like to continue your account another year?";
cin >> choice;

{
do
{
cout<< "would you like to deposit more money into this account? (y/n): ";
cin >> choice;
}
while (choice==y);

do
{
cout << "thank you for your service with this bank account. good bye.";
return 0;
}
while (choice==n);
}
}
}
}

}
}
}

@PJ63

You're not checking the inputs against a char. For that, you need to enclose the y and n in single quotes. 'y' and 'n'. Also, this change = -withdraw, will not decrease change by the withdrawal. It assigns change to a minus withdraw. To decrease change, it should be change -= withdraw which means 'change equals change minus the value of withdraw'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
ok so i made the changes, but im still stuck at the same place. 


/*
jake lemay, block 004
program will mimic a savings account
input: initial deposit, withdraw, balance
output: new balance, interest
processing: 
*/

#include<iostream>;
#include<iomanip>;
using namespace std;

int main()

{
	int interestRate;
	int initialDeposit;
	int deposit;
	int withdraw;
	int balance;
	int change;
	int months;
	char choice;
	char y;
	char n;
   
     
	//use for, while, and do while loops each at least once!!!
	cout << "what is your yearly interest rate for this account?\n"
		<< "please input xx.x% ONLY in the form xx.x, not 0.xxx\n"
		<< "an incorrect form will result in an incorrect rate\n"
		<< "example:" << "	" << "correct: 11.5" << "	" << "incorrect: 0.115\n\n"
		<< "interest rate: ";
	cin >> setprecision(3) >> interestRate;
    
	cout << "what is your initial deposit?: ";
	cin >> initialDeposit;
	
	if (initialDeposit < 250)
	{
		cout << "please deposit at least $250 into your account.\n"
			<< "what is your initial deposit?\n\n"
			<< "initial deposit: ";
		cin >> initialDeposit;
	} 
   
    else
    {
	   
        balance = initialDeposit + initialDeposit*interestRate/100;
        
        cout << "your balance is " << balance << "\n";
        
    
     for (;balance >= 250;)
	    {
			    cout<< "would you like to deposit more money into this account? (y/n): ";
				cin >> choice;
				
				while (choice = 'y');
				{
					cout << "how much would you like to deposit?: ";
					cin >> deposit;
					
					balance = balance+deposit*interestrate/100;
						
						cout << "you currently have " << balance << " in your account.\n";
						
				}
				
				while (choice == 'n')
				{
					cout << "would you like to withdraw money from this account? (y/n): ";
					cin >> choice;
					
					if (choice = 'y')
					{
						cout << "how much would you like to withdraw?: ";
						cin >> withdraw;
						
						if (withdraw <= 0)
						{
							cout << "you must withdraw more than $1\n"
								<< "how much would you like to withdraw?: ";
							cin >> withdraw;
						}
						else
						{
								balance = balance-withdraw*interestrate/100;
						
							if (balance < 250)
							{
								cout << "your balance cannot fall below $250.\n"
								<< "how much would you like to withdraw?: ";
								cin >> withdraw;
							}
							else
							{
								cout << "you currently have " << balance << " in your account.\n";
							}
							
					}
						while (choice == 'n')
					{
							balance = balance+balance*interestrate/100;
						cout << "you currently have " << balance << " in your account.";
						
					}
					
					for (;months=12;)
					{
					   cout << "would you like to continue your account another year?";
					    cin >> choice;
					    
					    {
					        do
					        {
					            cout<< "would you like to deposit more money into this account? (y/n): ";
			                   	cin >> choice;
					        }
					        while (choice=='y');
					        
					        do
					        {
					            cout << "thank you for your service. good bye.";
					            return 0; 
					        }
					        while (choice=='n');
					    }
				}   
        	} 
        }
      
    }
    }
}
	 
[code]
[/code]
Topic archived. No new replies allowed.