e的X平方加上e的y平方(C++ code)

类别:编程语言 点击:0 评论:0 推荐:
C++的作业,初学者看看参考...
#include <iostream.h>
double ee(double a,double b); //计算x的平方函数
double ee1(double a,double b); //计算y的平方函数
double mm(double a,double b); //累乘e^x
double mm1(double a,double b); //累乘e^y
const double e=2.7; //声明常量e的值
void main()
{
 double a;
 cout<<mm(a,e)+mm1(a,e)<<endl;
}
double ee(double a,double b)
{
 cout<<"请输入x的值:";
 cin>>a;
 double v=1.0;
 while(b--)
  v*=a;
 return v;
}
double ee1(double a,double b)
{
 cout<<"请输入y的值:";
 cin>>a;
 double v=1.0;
 while(b--)
  v*=a;
 return v;
}
double mm(double a,double b)
{
 double i=ee(a,2);
 double v=1.0;
 while(i--)
  v*=e;
 return v;
}
double mm1(double a,double b)
{
 double i=ee1(a,2);
 double v=1.0;
 while(i--)
  v*=e;
 return v;
}

本文地址:http://com.8s8s.com/it/it24769.htm