C++程序编译不通过 错误提示也没明显提示 这个哪里出现错误了 请教
#include <iostream>using namespace std;
struct travel_time
{
int hours;
int mins;
};
const int Mins_per_hr = 60;
travel_time sum (travel_time t1,travel_time t2);
void show_time (travel_time t);
int _tmain(int argc, _TCHAR* argv[])
{
travel_time day1 = {5,45};
travel_time day2 = {4,55};
travel_time trip = sum (day1,day2);
cout << "Two_day total: ";
show_time (trip);
travel_time day3 = {4,32};
cout << "Three-day total: ";
show_time (sum (trip,day3));
system ("pause");
return 0;
}
travel_time sum (travel_time t1,travel_time t2)
{
travel_time total;
total.mins = (t1.mins + t2.mins) % Mins_per_hr;
total.hours = t1.hours + t2.hours + (t1.mins + t2.mins) / Mins_per_hr;
return total;
}
void show (travel_time t)
{
cout << t.hours << " hours, "
<< t.mins << " minutes\n";
}