#include <iostream>
using namespace std;
// 编写一个程序,要求用户输入小时数和分钟数。在main()函数中,将这两个值传递给一个void()函数,后者以下面这样的格式显示这两个值
//Enter the number of hours:9
// Enter the number of minutes:28
//Time:9.28
void hourAndMinute(int,int); //声明调用函数原型
int main(){
int hour,minute;
cout<<"Enter the number of hours:";
cin>>hour;
cout<<" Enter the number of minutes:";
cin>>minute;
hourAndMinute(hour,minute);
return 0;
}
void hourAndMinute(int hour,int minute){
cout<<hour<<":"<<minute<<endl;
}
C++Primer Plus (第6版)中文版 第2章 2.7 编程练习 第7题
最新推荐文章于 2022-08-12 11:41:13 发布