I'm not sure what you mean by that. Yes, you need a (const) variable for each of those terms. But why on earth would you need a double? Both the number of friends and the lengths of their names are integers. When using C-strings, you generally don't use the exact length of the the inputted string as the length of the character array that you are storing into - you use a buffer that is longer than the maximum expected length of the string.
This was from a previous post in this thread:
CODE
const int maxFriends = 40;
const int maxNameLength = 20;
char friends [maxFriends][maxNameLength];
This creates an array 40 elements long, where each element is ANOTHER array, 20 characters long. The first index into the array gives you the friend number. And the syntax for the get() method is given by:
CODE
istream& get( char* buffer, streamsize num, char delim );
So to store the name of the 5th friend, you would use:
CODE
cin.get(friends[4], maxNameLength, '\n');
This tells the cin object to pull in a maximum of maxNameLength characters into the 5th row (zero-based arrays in C/C++, remember) of the array. The '\n' delimiter tells it to stop reading when a newline character is found in the input buffer.
If you expect that the names are going to be longer than 20 characters, change that const int variable to something bigger - most first or last names are shorter than 20 characters, but if you feel you need to go with a bigger buffer, go for it.
This post has been edited by jjhaag: 7 Jan, 2008 - 07:25 AM