Why won't my boolean work?

I am writing a code for a banking system. The menu options include depositing and withdrawing money. I have a bool set up :

 
bool accountExist(false);


and then the deposit label in my code looks like this

1
2
3
4
5
6
7
8
9
deposit:
    if(accountExist=true) // checks if account exists
        {
            //where the program shouldn't go
        }
    else if(accountExist=false)
        {
            //where the program should go
       


However, instead of going to where the program should go, when you go to the deposit label, it takes you straight to where the program shouldn't go. How do I fix this?
Last edited on
compare with ==.
your code assigns true in the middle of the comparison, which would trigger a warning if they were turned on.
Thanks, it works smoothly now :)
Topic archived. No new replies allowed.