Input is automatically bypassed and "no" string not recognized
Thundrstruck87 (2)

Hey everyone, I'm having a couple weird issues with my code that I can't figure out - so I would appreciate if I can get any help. I've started to learn C++ so I apologize if it's something simple I am missing.

From the photo and code, I have a couple cout and cin lines (lines 65 and 67) that work as intended up until "Year". For some reason that is automatically bypassed and you can't put anything in, where as the other input fields you can. I was able to type in a year (1990, or 2012 for example) if it behaved, but it feels like enter on my keyboard is hit twice and moves to the next line. However, I tried two different IDE's, and two different computers with the same issue, so something is weird with the code.

The other problem I am having is "no" is not recognized for some reason? Example would be the "NewCustomer()" function and the if statement where the "no" is. It returns the "bash: no: command not found" error message.

Thank you for the help!

You are viewing a single comment. View All
Kai_Justice (271)

Though I don't know much about cpp I know that the readstream cin can't assign its output to integers, I recommend doing something like this; changes are on lines 88-90.

Thundrstruck87 (2)

@Kai_Justice I appreciate it! I made the changes and I think we're getting closer. However when running it I get this. So I'm not sure if I'm missing something? I did at #include <string> at the top, but maybe C++ doesn't like this conversion.

Thundrstruck87 (2)

@Kai_Justice Nevermind that worked! I forgot to change "int Year" to "string Year" and that made it work - I appreciate the help!!