用C++编写一个程序,要求用户输入小时数和分钟数。在main()函数中,讲者两个值传递给一个void函数,后者以
下面这样的格式显示这两个值:
Enter the number of hours:9
Enter the number of minutes:28
Time: 9:28
#include<iostream>
using namespace std;
void showtime(int ,int);
int main()
{
int hour;
int min;
cout << "Enter the number of hours: ";
cin >> hour;
cout << "Enter the number of minutes: "腔誉;
cin >> min;
showtime(hour,min);
return 0;
}
void showtime(int h,int m)
{
cout << "伍闹段Time: " << h <弯帆< ":" << m <<endl;
}