| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Displaying tickets between two dates ?
Hi there,
I'm building a small program wich handles ticket sales for a lowbudget airliner(project for school )I'm trying to display all trips inbetween two dates. so far I've come with this code. But, of course its not working :P any ideas . cheers. Konni. Code:
void __fastcall TfrmMain::btnShowPeriodClick(TObject *Sender)
{
lsvLists->Items->Clear();
lsvLists->Column[0]->Caption = "Flightnumber";
lsvLists->Column[1]->Caption = "To";
lsvLists->Column[2]->Caption = "From";
lsvLists->Column[3]->Caption = "Date";
Flight flight;
if (((int)dtpDate1 >= (TDateTime)flight.getDayDeparture()) && ((int)dtpDate2 <= (TDateTime)flight.getDayDeparture()))
{
TListItem* Item;
Item=lsvLists->Items->Add();
Item->Caption = flight.getFlightNumber();
Item->SubItems->Add(flight.getArrivalPlace());
Item->SubItems->Add(flight.getDeparturePlace());
Item->SubItems->Add((TDateTime)flight.getDayDeparture());
}
}
|
|
#2
|
|||
|
|||
|
Is there a specific area your having trouble with? It looks like you already have a flight class created. You can stick them in a list, vector, array, tree whichever. You may want to do some operator overloading for the >> and << operators to make it easier to input and output flights. If you are using an stl List or Vector you might need to overload the == operator so you can use find() algothim to get specific flights.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Displaying tickets between two dates ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|