[求助]c++问题
[求助]C++初级问题编写一个程序,要求用户输入小时数和分钟数.在main()函数中,将两个值传递给一个void函数,后者以下面这样的格式显示这两个值:Enter number of hours:9
Enter number of minutes:28
Time: 9:28
请各位大哥帮帮忙!
[此贴子已经被作者于2007-5-14 17:02:56编辑过]
说得好~~
严重赞成楼上的~~~
#include<iostream>
using namespace std;
void time(int hour,int minute)
{
cout<<hour<<":";
if(minute<10)
cout<<"0"<<minute<<endl;
else
cout<<minute<<endl;
}
int main()
{
int a,b;
cout<<"Enter number of hours:";
cin>>a;
cout<<"Enter number of minutes:";
cin>>b;
time(a,b);
return 0;
}