本文整理汇总了C++中Ticket::Display方法的典型用法代码示例。如果您正苦于以下问题:C++ Ticket::Display方法的具体用法?C++ Ticket::Display怎么用?C++ Ticket::Display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::Display方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char * argv[]) {
//initialize input variables
Date_Time DT = *new Date_Time;
string SN;
string VN;
aSeat ST = *new aSeat;
//ensure working program
cout << "This is program Test_Ticket\n";
//get inputs
cout << "Please Enter Paramaters for Ticket\n";
cout << "Show Name: ";
getline(cin, SN);
cout << "Venue Name: ";
getline(cin, VN);
cout << "Day: ";
cin >> DT.day;
Clear_Keyboard_Input_Buffer();
cout << "Month: ";
cin >> DT.month;
Clear_Keyboard_Input_Buffer();
cout << "Year: ";
cin >> DT.year;
Clear_Keyboard_Input_Buffer();
cout << "Hour: ";
cin >> DT.hour;
Clear_Keyboard_Input_Buffer();
cout << "Minute: ";
cin >> DT.minute;
Clear_Keyboard_Input_Buffer();
cout << "Seat Row: ";
cin >> ST.row;
Clear_Keyboard_Input_Buffer();
cout << "Seat Number: ";
cin >> ST.num;
Clear_Keyboard_Input_Buffer();
cout << endl;
//create ticket
Ticket *ticket = new Ticket(SN, VN, DT, ST);
//display initial ticket using display()
cout << "Initial Ticket: " << endl;
ticket->Display();
//display initial ticket using accessor fuctions
cout << endl << "Using accessor functions: " << endl;
cout << "Show_Name = " << ticket->Show_Name() << endl;
cout << "Venue_Name = " << ticket->Venue_Name() << endl;
cout << "Date = " << ticket->When().month << "/" << ticket->When().day << "/" << ticket->When().year << endl;
cout << "Time = " << setw(2)<< setfill('0') << ticket->When().hour << ":" << setw(2) << setfill('0') << ticket->When().minute << endl;
cout << "Seat " << ticket->Seat().row << ticket->Seat().num << endl;
if (ticket->Sold() == false) {
cout << "Not Sold" << endl;
}
else{
cout << "Sold" << endl;
}
//sell the ticket with Sell()
cout << endl << "Calling sell for ticket" << endl;
ticket->Sell();
//display ticket after sale using Display()
cout << endl << "After ticket sold:" << endl;
ticket->Display();
delete ticket;
cin.get(); //hold window open
return 0;
}