master^2
pangfuyou 4 years ago
parent 887b2bf895
commit 71454cf2dc

@ -1,59 +0,0 @@
package open;
import java.util.Scanner;
public class main {
public main() {
}
public static void main(String[] args) {
double a,c; String b;
Scanner sc = new Scanner(System.in);
a=sc.nextDouble();
b=sc.next();
if(b.equals("sin")) {
sanjiao d=new sanjiao();
System.out.println(d.sanjiao("sin", a));
}
else if(b.equals("cos")) {
sanjiao d=new sanjiao();
System.out.println(d.sanjiao("cos", a));
}
else if(b.equals("tan")) {
sanjiao d=new sanjiao();
System.out.println(d.sanjiao("tan", a));
}
else if(b.equals("^")) {
zhishu d=new zhishu();
System.out.println(d.zhishu(a));
}
else if(b.equals("log")) {
duishu d=new duishu();
c=sc.nextDouble();
System.out.println(d.duishu(a, c));
}
else if(b.equals("+")) {
sizeyunsuan d=new sizeyunsuan();
c=sc.nextDouble();
System.out.println(d.add(a, c));
}
else if(b.equals("-")) {
sizeyunsuan d=new sizeyunsuan();
c=sc.nextDouble();
System.out.println(d.subtract(a, c));
}
else if(b.equals("*")) {
sizeyunsuan d=new sizeyunsuan();
c=sc.nextDouble();
System.out.println(d.multiply(a, c));
}
else if(b.equals("/")) {
sizeyunsuan d=new sizeyunsuan();
c=sc.nextDouble();
System.out.println(d.divide(a, c));
}
else System.out.println("错误");
}
}

@ -1,22 +0,0 @@
int main()
{
double x,k=1,f=1,e,n;
double a=0;
scanf("%lf %lf",&x,&n);
if(n < 0)
printf("error");
else
{
for(int i = 1;i <= n;i++)
{
a =pow((double)x,(double)i);
k = k*i;
e = a/k;
f += e;
}
printf("%.6lf",f);
}
return 0;
}
Loading…
Cancel
Save