#include<iostream>
using std::cout;
using std::endl;
struct Time
{
int hour;
int minute;
int second;
}; //½á¹¹´ø·ÖºÅ
void printMilitary(const Time &);
void printStandard(const Time &);
int main()
{
Time dinnerTime;
dinnerTime.hour = 18;
dinnerTime.second = 30;
dinnerTime.minute = 0;
cout<<"dinner will be held at: ";
printMilitary(dinnerTime);
cout<<"military time,\nwhile is: ";
(dinnerTime);
cout<<"stand time: \n";
dinnerTime.hour = 29;
dinnerTime.minute = 73;
cout<<"\n time with incalid values:";
printMilitary(dinnerTime);
cout<<endl;
return 0;
}
void printMilitary (const Time &)
{
cout<<(t.hour < 10 ?"0" :" ")<<t.hour<<":"
<<(t.minute < 10 ?"0" :" ")<<t.minute;
}
void printStandard (const Time &)
{
cout<<((t.hour = 0 || t.hour =12 ) ?
12 : t.hour & 12)
<<":"<<(t.minute < 10 ? "0" : " ")<<t.minute
<<":"<<(t.second < 10 ? "0" : " ")<<t.second
<<(t.hour < 12 ? "AM" : "PM");
}