I can not figure out why in the beginning of my program if I type in a space it skips the next part of the program. For example my program asks the user to enter his or her name, if I were to enter John (space) Doe it will skip the next part of the code asking for the users address. If I type just John it is fine and moves on to the next part of code asking for the users address. Then here as well if I were to type 123 (space) Drive (space) DR the program skips the next part of code. If anyone can help me figure this out it would be greatly appreciated. Thank you in advance for any help. My code is below.
if I were to enter John (space) Doe it will skip the next part of the code asking for the users address. If I type just John it is fine and moves on to the next part of code asking for the users address
This happens because cin's >> operator will drop leading whitespace and stop input at the first trailing whitespace i.e. the whitespace b/w "John" and "Doe"