So I have one main concern, whenever I run the program and choose a selection, it will not allow me to input any information. It simply loops back to the selection menu. I had this problem when creating the code, but had to complete the assignment. I am now trying to fix it as we are in our testing phase. I have seen several programs similar but I am not sure what is wrong with mine. Any help would be greatly appreciated!
yes, it is supposed to allow the user to input the amount they want to withdraw from the account but it keeps running right through back to the main menu.
Not sure that this will fix it, but why do you have those while statements in your switch code? By going to case 1:, for example, selection == 1 is already guaranteed.
I think while statement on the line 53 and 67 is uneeded
And on the line 57 you're using relational operator
But still i don't understand why the cin part is skipped ._. Maybe someone else here understand why, sorry
Try to use
1 2
using std::cin
using std::cout
instead of writng std:: each time you wrte cin or cout
i fixed the operators, that definitely took out quite a bit of errors I had. My professor has her code with std::cout and std::cin in all of her examples and guidelines so that's the only reason I had mine like that.
okay I believe I may have figured out the kinks! thanks for the help.. unless someone has any advice on it still debiting when there is not enough money....
but here it is updated...
It's because you already remove the money before checking to see if there is enough money in the account, I think. Put the account1 -= withdrawal; line in the if statement. You'll have to introduce curly brackets, of course.
line 55 - you're subtracting the withdrawal amount before you check to see if there's enough money at line 57
debiting from account 2 -
line 69 - you're printing out the value of withdrawal instead of the withdraw that the person input on line 65. And you're not actually debiting account2.
transferring between accounts - should you be checking that the account has a sufficient balance to be able to transfer the amount requested?