//2.7_6.cpp 小时和分钟显示
# include <iostream>
using namespace std;
void func(int,int);
int main()
{
int hours=0,minutes=0;
cout<<"Enter the number of hours: ";
cin>>hours;
cout<<"Enter the number of minutes: ";
cin>>minutes;
func(hours,minutes);
cout<<endl;
return 0;
}
void func(int h,int m)
{
cout<<"Time: "<<h<<":"<<m;
}
/*
输出结果:
Enter the number of hours: 9
Enter the number of minutes: 28
Time: 9:28
Press any key to continue
*/
按题目,其实没检验用户输入是否超出分钟和小时