//19 结构体与函数//由于结构可以看作一个数据类型并且可以赋值,因为我们可以将结构传递到函数中,或者在函数中返回一个结构//按值返回我们知道需要复制返回的结构,结构体可以容纳不同的类型的变量,相应产生的问题是复制数据也很多,假如我们不想复制数据,那么就要按地址返回/*#includeusing namespace std;struct time{ int hour; int minute;};const int perhour = 60; //定义分钟数//time sum(time t1, time t2);time *sum(time t1, time t2);void show(time t);int main(){ time one ={8,15}; time two = {6,55}; time *day = sum(one,two); cout<<"两天的时间总计:"; show(*day); time day3 = {9,35}; cout<<"三天时间总计:"; //注意这里的day已经不是一个结构体变量,而是一个结构体地址 time *p = sum(*day,day3); show(*p); delete day; delete p; return 0;}time *sum(time t1, time t2){ //time total; time *total = new time; total->minute = (t1.minute + t2.minute) % perhour; total->hour = t1.hour + t2.hour + (t1.minute + t2.minute) / perhour; //total.minute = (t1.minute + t2.minute) % perhour; //total.hour = t1.hour + t2.hour + (t1.minute + t2.minute) / perhour; return total;}void show(time t){ cout< <<":"< <