您的位置:首页 > 编程语言 > C语言/C++

C++ Primer Plus 第六版课后编程答案 2.6-2.7

2014-03-27 15:35 435 查看
2.6

#include <iostream.h>
double change(double y);
int main()
{
cout<<"Enter the number of light years:\n";
double n;
cin>>n;
cout<<"Your number is"<<n<<endl;
cout<<"==="<<change(n);
cin.get();
cin.get();
return 0;

}

double change(double y)
{

return y*62340;
}


2.7

//7
#include <iostream.h>
void see(int h,int m);
int main()
{
cout<<"Enter the number of hours:";
int h;
cin>>h;
// cout<<  h<<endl;
cout<<"Enter the number of minutes:";
int m;
cin>>m;
//cout<<m<<endl;
see(h,m);
cin.get();
cin.get();
cin.get();
cin.get();
return 0;

}

void see(int h,int m)
{
cout<<"Time"<<h<<":"<<m<<endl;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: