I gather the output of s is always blank? the extraction operator >> ignores whitespace characters but getline() does not. A new line character remains in the stream after your first input.
Use cin.sync() before getline() to clear the input stream.
Well Im new too, but when looking at your code, The first thing I noticed was that if that was to run.
Your program will run, then go off before you got to see it work. you would need a system ("pause");
before the return to get it to stop,
as in for the difference between the two, for output, on a monitor, nothing as far I noticed, but when putting output to a file eg ".txt." for fstreams
then you will need getline to identify which string variable your dealing with.
Side Note: like I said, Im new to this as well, just to make sure I understand what I read, its bad to use System "Pause"; because its only a windows related problem?.
Im sorry I just want to make sure I know why its bad, and what would be a better solution to that problem?
Could you explain what you mean by this? and link to any relevant articles.. I've googled around but don't see any information regarding such an issue.
-edit-
Nvm! found an informative post here:-