Hello briancb2004,
The problem is because you may not understand the difference between formatted and unformatted input.
Formatted input like
cin >> _City;
will take what you type and store it in the input buffer until you press "Enter". Then it will extract from the input buffer until it finds a white space or new line (\n) whichever comes first. So when you enter "Yuba City" only "Yuba" is stored in "city" because it stops at the first space leaving "City" in the input buffer for the next read. On the next read it will not wait for keyboard input, but put "city" in the variable "_College" thus throwing everything off.
You could change line 22 to
std::getline(std::cin, city);
and this will keep any spaces in the string and extract the "\n" which it discards. Leaving the input buffer empty and storing everything that you have typed.
I would also suggest not starting your variable names with an underscore. This may be legal, but it is best left to the header files so there is no conflict between your variables and the header files. Also it is most common to start a regular variable with a lower case letter. You can use "camelCase", as you have, or use the underscore to separate words.
When mixing formatted and unformatted input you will need to follow the last "cin >>" with
|
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // <--- Requires header file <limits>.
|
before a "getline" is used. Otherwise the "getline" will get the "\n" left in the input buffer.
Andy