method output

Hi, in my assignment I need to output a boarding pass in a format:

FROM DATE TIME
<flight1.departureAirport> <departDate.printDate()> <departTime.printTime()>

TO
<flight1.arrivalAirport> <arrivalDate.printDate()> <arrivalTime.printTime()>


TOTAL TIME: <flight1.arrivalTime - flight1.departureTime>


departure and arrival airport are strings and and i have no problem with outputting it where I want it. But dates and times come form methods like this:

1
2
  void printTime () {
    cout << setw(2) << setfill('0') << hours << ":" << setw(2) << minutes << setfill(' ') << endl;};


 
  void printDate () {cout << setw(2) << setfill('0') << day << "/" << setw(2) << month << "/" << year << endl;};


So when I say
cout << endl << departureAirport << " " ; departureDate.printDate (); cout << " "; departureTime.printTime () ;

departure time comes to a second line.

Is there any way to control where it is outputted. Or any other ideas how to fix it?
If you want all the output on the same line you'll need to remove the endl statements inside your functions.
i feel so incredibly silly, thanks
Topic archived. No new replies allowed.