C++ primer plus第六版课后编程题答案7.1


7.1

 

#include<iostream>

using namespace std;
double tiaohe(double ,double );
void main71()
{

	double a,b;
	cout<<"Plesase enter 2 number :";
	cin>>a;
	cin>>b;
	if(a==0||b==0)
		cout<<"\nWrong input"<<endl;
	else
		cout<<"tiaohe is "<<tiaohe(a,b)<<endl;

	system("pause");



}

double tiaohe(double a,double b)
{
	return 2.0*a*b/(a+b);

}

 

 


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注