char mName [51];
is a so called "C-string". It's an array of 51 characters, the last of which is reserved for the delimiter character '\0'.
Typically, magic numbers like this are frowned upon, because it's bad practice. I'll show you a better way of doing it later on.
std::cin.getline
extracts characters from the stream (input) and stores them in a C-string, in this case, mName. It continues extracting until a delimiting character is reached, or until
n characters have been extracted (where
n is the second parameter, in this case 50).
In the context of this program, std::cin.getline() is more applicable than std::cin, because std::cin is picky about white-space characters, where as getline is not. This is important because movie titles may have spaces in them.
std::fixed
sets the floatfield format flag for the specified stream, which means you're using fixed floating point notation.
std::setprecision
sets the decimal precision for outputted floating point values for the specified stream.
Look at this documentation for an example and additional info:
http://www.cplusplus.com/reference/iomanip/setprecision/
Anyhow, like I said, magic numbers aren't really a good thing. Here would have been a better way to do it.
1 2 3 4 5 6
|
const unsigned short NAME_LEN = 51;
char mName[NAME_LEN];
//...
std::cin.getline(mName, NAME_LEN-1);
|