Nope, doesn't work. Here's the code for the function that prints the list (the setw() parameters are fairly arbitrary):
Code:
void printMember(phoneNumber L[], int i)
{
cout << i << ". " << left << L[i].name;
if (L[i].areaCode==0)
cout << setw(50) << "(000) 000-0000";
else
cout << right << setw(20) << "(" << L[i].areaCode << ") " << L[i].exchange << "-" << L[i].number;
cout << endl;
}
This is what I'm trying to get it to look like:
Code:
1. (000) 000-0000
2. (000) 000-0000
3. Mary Smith (123) 456-7890
4. John Anderson (321) 789-4567
5. (000) 000-0000
etc.
Right now, Mary Smith's number is printed three spaces to the left because her name is three characters shorter than John Anderson's.