Colossusx10
n00b
- Joined
- May 19, 2007
- Messages
- 8
I need to create a function called PrintFlightManifest. This function asks the user for a flight number (1 or 2), then the function prints all the passengers on that flight (no more than 20 passenger on each flight). I must use the overloaded >> operator.
This is the definition I have in my header file
Air is the structure.
I have 2 questions:
1. Is the code above even correct?
2. Can someone give me at least a hint on how to even begin to write this code?
I wrote a code for the << operator. Is that at least correct?
Any help would be greatly appreciated.
This is the definition I have in my header file
Code:
friend ostream &operator<<(ostream &,Air &);
Air is the structure.
I have 2 questions:
1. Is the code above even correct?
2. Can someone give me at least a hint on how to even begin to write this code?
I wrote a code for the << operator. Is that at least correct?
Code:
ostream &operator<<(ostream &out, Air &getpass)
{
Air *current = new Air;
for(current = getpass.head; current != NULL; current = current->next)
{
out << current->person <<endl;
}
return out;
}
Any help would be greatly appreciated.