I'm going to assume that you understand what a function is.
So, line 3 simply outputs the prompt that is fed to the function. If the string fed to the function is "enter pressure" after line 3 has executed the console looks like this:
where the underscore represents the cursor.
On line 4 we check to see if the next character that would be extracted from std::cin is a newline character. If it is, on line 6 we exttract and discard it, then on line 7 we return a value of 0. That takes care of interpreting a 'blank' line as 0.
I believe you understand what lines 10 and 11 do, but you may not be familiar enough with the details to realize what is
not extracted in line 11. It may help to visualize the input stream as a string. If a person enters 5.4 and presses enter, the input stream looks like: "5.4\n".
cin >> num
will extract the 5.4 from the stream leaving "\n" in the stream.
If we just returned num at this point, you can see there would still be a newline in the input stream. On the next call to get_num we would encounter this newline on line 4 of get_num and interpret it as a blank line, robbing the user of the chance to enter any value. To avoid this we extract and discard the newline on line 12, so that we are assured of having an empty input stream for the next input operation.
Now, you might be wondering... why not just do what you did on line 6? And it is a good question. That would work for most uses of the program however if a user were to input, instead of
"5.4\n"
,
"5.4 \n"
after line 11 the input stream would look like
" \n"
and if we were only to extract and discard one character, you can see there would still be a newline in the stream ready to gunk up the works.
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n') ;
is the canonical way to say "discard the rest of the current line." The first argument is the maximum number of characters to discard, and the last argument is the character which we should discard values up to (if you don't specify one it will consume all characters up to the end of file marker.)
std::numeric_limits<std::streamsize>::max()
returns the maximum value a std::streamsize type can hold. As we're dealing with a stream, I think the reason we just std::streamsize is fairly obvious.
If you need further explanation, ask away.
[edit: typo]