Why won't my statement work with the spaces | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

14th Aug 2017, 1:14 PM
X-1
X-1 - avatar
1 Answer
+ 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/
14th Aug 2017, 1:18 PM
jay
jay - avatar