求高手进来用C语言编出一个数学计算器程序
#include
double u = (1 + a * pow(N - 1, 0.49) / sqrt(N);
是要两个程序吗?
第1个:
#include#include
double gs(double x,double T){ double temp; temp=15.5307-44.3977*x+80.9385*x*x+(-32597.5+122835*x+160757*x*x)/T; return temp;}
void main(void){ double P,x,lg_P,T; printf("Please input x:"); scanf("%lf",&x);A: printf("Please input T:"); scanf("%lf",&T); if(T==0)//分母不能为0,为0重输 goto A; lg_P=gs(x,T); P=pow(10,lg_P); printf("
lg_P=%.10f
",lg_P); printf("P=%e
",P);}
第2个:
#include#include
double g(double P){ double temp; temp=121.761+5.89e-7*(P-21.4e+5)-1e-15*(P*P-4.584e+10); return temp;}
double q(double x){ double temp; temp=-40.2-569.5*x+610.7*x*x; return temp;}
double y(double x,double t){ double temp; temp=1.52*t+2.54*x*t+(0.99*x-0.358)*1e-2*t*t; return temp;}
void main(void){ double h,P,t,x; printf("Please input P:"); scanf("%lf",&P); printf("Please input t:"); scanf("%lf",&t); printf("Please input x:"); scanf("%lf",&x); h=g(P)+q(x)+y(x,t); printf("h=%.20e
",h);}
补充第1题:
#include/* ------- 已知x,P,求T ------- */#include
double gs(double P,double x){ double temp1,temp2; temp1=log10(P); temp1=temp1-15.5307+44.3977*x-80.9385*x*x; temp2=-32597.5+122835*x+160757*x*x; temp2=temp2/temp1; return temp2;}
void main(void){ double P,x,T; printf("Please input x:"); scanf("%lf",&x);A: printf("Please input P:"); scanf("%lf",&P); if(P<=0)//对数底数不能小于等于0,小于等于0重输 { printf("'P' must be above 0 ,input again.
"); goto A; } T=gs(P,x); printf("T=%.20e
",T);}
#include/* ------- 已知P,T,求x ------- */#include
void gs(double P,double T){ double a,b,c,delta,x1,x2,tmp; a=80.9385-160757/T; b=122835/T-44.3977; c=15.5307-32597.5/T-log10(P); delta=b*b-4*a*c; printf("Result:
"); if(delta>0) { tmp=sqrt(delta); x1=(-b+tmp)/(2*a); x2=(-b-tmp)/(2*a); printf("delta>0,there are two answers:x1=%.20e , x2=%.20e
",x1,x2); } else if(delta==0) { x1=(-b)/(2*a); printf("delta=0,there is one answer:x1=x2=%.
",x1); } else { printf("delta,<0,there is no answer.
"); }}
void main(void){ double P,T;A: printf("Please input P:"); scanf("%lf",&P); if(P<=0)//对数底数不能小于等于0,小于等于0重输 { printf("'P' must be above 0 ,input again.
"); goto A; }B: printf("Please input T:"); scanf("%lf",&T); if(T==0)//分母不能为0,为0重输 { printf("'T' can not be 0 ,input again.
"); goto B; } gs(P,T);}
#include<stdio.h>
#include<math.h>
main()
{
while(1)
{
int a,b,c;
printf("请输入两个数,以逗号隔开
");
scanf("%d,%d",&a,&b);
printf("选择算法
") ;
printf(" 1.乘 2.除
3.加 4.减
") ;
scanf("%d",&c);
switch(c)
{
case 1:c=a*b;printf("结果为%d
",c);break;
case 2:if(b==0)
{ printf("除数不能为0
");break;}
else
{c=a/b;
printf("结果为%d
",c);break;}
case 3:c=a+b;printf("结果为%d
",c);break;
case 4:c=a-b;printf("结果为%d
",c);break;
}
}
}
求高手进来用C语言编出一个数学计算器程序视频
相关评论:
崔知治include<math.h> main(){ while(1){ int a,b,c;printf("请输入两个数,以逗号隔开\\n");scanf("%d,%d",&a,&b);printf("选择算法\\n") ;printf(" 1.乘 2.除\\n 3.加 4.减\\n") ;scanf("%d",&c);switch(c){ case 1:c=a*b;printf("结果为%d\\n",c);break;case ...
崔知治f(int a[], int n) { for (int i = 0; i < n-1; i++)if(a[i] > a[i+1])return 0;return 1;
崔知治include<stdio.h>int main(){double a;scanf("%lf",&a);switch((int)a\/20){ case 0:printf("D");break; case 1:printf("C");break; case 2:printf("b");break; case 3:printf("A");break; case 4:printf("E");break; case 5:printf("S");break; default: \/\/ 少年不要忘...
崔知治}while(!(guess>=1&&guess<=100));\/*结束第二层DO~WHILE循环*\/ if (guess<number)printf("\\n Your answer is low,try again!");\/*如果用户输入的数字小于系统随机数,则输出数字太小的提示信息*\/ if (guess>number)printf("\\n Your answer is high,try again!");\/*如果用户输入的数字...
崔知治include<stdio.h> void main(){ int a,s;s=1;printf("请输入一个整数");scanf("%d",&a);while (a>0){ s=s*(a % 10);a=a\/10;} printf("a=%d",s);}
崔知治include<stdio.h> void main(void){ float s=1;int m=0;printf("输入m的整数值:");scanf("%d",&m);while(m>1){ s=s-1\/(float)(m);m--;} printf("%f\\n",s);system("pause");\/\/程序在此处暂停 }
崔知治void main(){ float n,s=1,t=1;for(n=1;n<=20;n+=2){t=t*n;s=s+3;} printf("s=%e\\n",s);}
崔知治int main(void){ int yearB=0, monthB=0, dayB=0;int yearE=0, monthE=0, dayE=0;int difYear, difMonth;\/\/ 输入日期1 printf("Input the beginning date(yyyy.mm.dd)\\n");scanf("%d.%d.%d", &yearB, &monthB, &dayB);\/\/ printf( "%d.%d.%d\\n", yearB, monthB, day...
崔知治int IsDevided(int number,int dev){ if(number %dev == 0){ return 1;} return 0;} void EasyDone(int a){ int chose;int i,j;printf("Input your chose\\n1>能被3整除的"<Enter 1>","\\n2>能被5整除的<Enter 2>","\\n3>能被3或5整除的<Enter 3>\\n");scanf("%d",&chose)...
崔知治4294967295+0=4294967295 4294967295+1=0 4294967295+2=1 4294967295+3=2 4294967295+4=3 4294967295+5=4 4294967295+6=5 4294967295+7=6 4294967295+8=7 4294967295+9=8 4294967295*0=0 4294967295*1=4294967295 4294967295*2=4294967294 4294967295*3=4294967293 4294967295*4=4294967292 4294967295*5=...