October 2011
Beginner to intermediate
1200 pages
35h 33m
English
cin.get() Should You Use?Listing 4.5 in Chapter 4 uses this code:
char name[ArSize];...cout << "Enter your name:\n";cin.get(name, ArSize).get();
The last line is equivalent to two consecutive function calls:
cin.get(name, ArSize);cin.get();
One version of cin.get() takes two arguments: the array name, which is the address of the string (technically, type char*), and ArSize, which is an integer of type int. (Recall that the name of an array is the address of its first element, so the name of a character array is type char*.) Then the program uses cin.get() with no arguments. And most recently, we’ve used cin.get() this way:
char ch;cin.get(ch);
This time cin.get() has one argument, and it is type char.
Once again it is time for those of ...
Read now
Unlock full access