Running only if statement, but not else

For some reason when I input 'y' it runs the if statement as intended but when I input something else, to trigger the else statement it runs the if statement instead. Can someone help point out my error?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
        int choice;
	char depo;
	while (1)
	{
		cout << "Total Balance: $" << totalWinnings << endl;
		if (totalWinnings == 0)
		{
			cout << "Looks like your outta chips! Would you like to make a deposit? (y or n)" << endl;
			cin >> depo;
			if (depo='y')
			{
				cout << "Please enter the amount you would like to deposit: ";
				cin >> deposit;
				totalWinnings += deposit;
				cout << "$" << deposit << " Has been credited to your account." << endl;

			}
			else 
				cout << "Goodbye!" << endl;
				
			
		}
= means assignment. == is a test for equality.

You need ==, not =, on line 10.
Ah, can't believe I overlooked me using the assignment operator there, thanks.
Topic archived. No new replies allowed.