You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.0 KiB
53 lines
1.0 KiB
#include<stdio.h>
|
|
#include "a.hpp"
|
|
#include "b.hpp"
|
|
#include "c.hpp"
|
|
#include "d.hpp"
|
|
|
|
int main()
|
|
{
|
|
int op;
|
|
float x,sum ;
|
|
|
|
printf("1. e^x\n");
|
|
printf("2. log2x\n");
|
|
printf("3. x+5\n");
|
|
printf("4. x-5\n");
|
|
printf("5. x*5\n");
|
|
printf("6. x/5\n");
|
|
printf("7. sinx\n");
|
|
printf("8. cosx\n");
|
|
printf("9. tanx\n");
|
|
printf("10. cotx\n");
|
|
printf("0. exit\n");
|
|
printf("Firts,please set the value of x\n");
|
|
scanf("%f",&x);
|
|
|
|
while(1)
|
|
{
|
|
printf("Then,please select the opration\n");
|
|
scanf("%d",&op);
|
|
|
|
switch(op)
|
|
{
|
|
case 1 :printf("%f\n",EXP(x));break;
|
|
case 2 :printf("%f\n",LOG(x,2));break;
|
|
case 3 :printf("%f\n",ADD(x));break;
|
|
case 4 :printf("%f\n",SUB(x));break;
|
|
case 5 :printf("%f\n",MUL(x));break;
|
|
case 6 :printf("%f\n",DIV(x));break;
|
|
case 7 :printf("%f\n",SIN(x));break;
|
|
case 8 :printf("%f\n",COS(x));break;
|
|
case 9 :printf("%f\n",TAN(x));break;
|
|
case 10 :printf("%f\n",COT(x));break;
|
|
case 0 :break;
|
|
default :printf("error\n");break;
|
|
}
|
|
if(!op)
|
|
break;
|
|
}
|
|
printf("thanks");
|
|
|
|
return 0;
|
|
}
|