+ 1
Why won't my statement work with the spaces
rn I'm trying to create a bank account class, in which you have the option to withdraw, deposit or log out. when it comes to the log out method, it only works if I change it to accept something like "l/o" or "logout", where in which there are no spaces. is there a way to change this, so that the condition will work with "log out"? https://code.sololearn.com/c8DfgR48mCER/?ref=app
1 Resposta
+ 5
instead of cin use getline
when cin sees a space it thinks that is the end of the stream/input.
http://www.cplusplus.com/reference/string/string/getline/