7.编写一个程序,要求用户输入小时数和分钟数。在 main()函数中,将这两个值传递给一个 void 函数,后者以下面这样的格式显示这两个值 :
Enter the numberof hours : 9
Enter the number of minutes : 28
Time : 9 : 28
#pragma region 编程练习7.cpp
/*
7.编写一个程序,要求用户输入小时数和分钟数。在 main()函数中,将这两个值传递给一个 void 函数,后者以下面这样的格式显示这两个值 :
Enter the numberof hours : 9
Enter the number of minutes : 28
Time : 9 : 28
*/
#if 1
#include <iostream>
void MyTime(double hours, double minutes);
int main()
{
using namespace std;
double hours, minutes;
cout << "Enter the numberof hours : ";
cin >> hours;
cout << "Enter the number of minutes : ";
cin >> minutes;
MyTime(hours, minutes);
return 0;
}
void MyTime(double hours, double minutes)
{
using namespace std;
cout << "Time : " << hours << " : " << minutes;
}
#endif
#pragma endregion