#include "stdio.h"
#include "math.h"
#define ERROR -1
#define OK 0
int getAnswer(void)
{
double a,x;
double y;
scanf("Please input a = %f,x = %f",&a,&x);
y = cos(a * x) + log(a + x) + exp(x);
printf("get the answer = %f",y);
}
int getRate(void)
{
double dblYear = 0,dblRate = 0;
int nbase = 0;
double dblInterest;
scanf("Please input the money = %.2f,and the rate = %.2f,the years = %.2f",&nbase,&dblRate,&dblYear);
dblInterest = nbase * (1 + dblRate) * dblYear - nbase;
printf("the Interest = %.2f",dblInterest);
return OK;
}
int getCapacity(void)
{
double P = 104;
double cosfai1 = 0.6;
double cosfai = 0.95;
double frequence = 50;
double U = 220;
double capacity;
double tanfai1,tanfai;
double tmp;
tmp = 1 - cosfai1 * cosfai1;
if(tmp < 0) return ERROR;
tanfai1 = sqrt(tmp) / cosfai1;
tmp = 1 - cosfai * cosfai;
if(tmp < 0) return ERROR;
tanfai = sqrt(tmp) / cosfai;
capacity = P * (tanfai1 - tanfai) / (2 * frequence * U);
return OK;
}