]#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <malloc.h>
#include <dos.h>
main()
{
system("title 万能计算器");
system("color 1c");
printf(" \n──────────────────万能计算器──────────────── \n");
printf(" \t┏━━━━━━━━━━━━━━━━━━━━━┓\n");
printf(" \t┃1.科学计算器 ┃\n");
printf(" \t┃2.八进制计算器 ┃\n");
printf(" \t┃3.十六进制计算器 ┃\n");
printf(" \t┃4.二进制计算器 ┃\n");
printf(" \t┗━━━━━━━━━━━━━━━━━━━━━┛\n\n\n");
printf(" 请输入:");
char A;
A=getch();
{
if(A=='1')
{
system("title 科学计算器");
while(1)
{
system("cls");
system ("color 1c");
int a,b,c,d,e,f;
double i,m,n;
const double pi=3.141592;
printf("==========================================\n");
printf("欢迎使用计算器。\n\n");
printf("(a是关于三角函数与双曲三角函数,x)输入a:");
scanf("%d",&a);
printf("(b是关于反三角函数,对数,e为底指数,y)输入b:");
scanf("%d",&b);
printf("输入底数:\t");
scanf("%d",&c);
printf("输入指数:\t");
scanf("%d",&d);
printf("输入根:\t");
scanf("%lf",&i);
e=a+b;
printf("和是%d\t",e);
e=a*b;
printf("积是%d\t",e);
e=a-b;
printf("差是%d\t",e);
n=a/b;
printf("商是%lf\n",n);
e = pow(c, d);
printf("乘方是%d\t\t\t",e);
printf("二次根是%lf\n",sqrt(i));
m=sin(a*pi/180);
printf("sin正弦是%lf\t",m);
m=sinh(a);
printf("sinh双曲正弦是%lf\t",m);
m=cos(a);
printf("asin反正弦是%lf\t\n",m);
m=acos(a);
printf("cos余弦是%lf\t",m);
m=cosh(a);
printf("cosh双曲余弦是%lf\t",m);
m=tan(a);
printf("acos反余弦是%lf\t\n",m);
m=atan(a);
printf("tan正切是%lf\t",m);
m=tanh(a);
printf("tanh双曲正切是%lf\t",m);
m=asin(a);
printf("atan反正切(主值)是%lf\t",m);
m = log10(b);
printf("常用对数为:%lf\t",m);
m = log(exp(b));
printf("e为底指数为:%lf\t",m);
m = hypot(a,b);
printf("第三条边为:%lf\t",m);
sleep(1000);
printf("\n\n\n 请问您要再次使用吗? q.使用 其他键.关闭");
printf("\n\n 请输入:");
{
char p;
p=getch();
{
if(p=='q' || p=='q')
{
}
else
{
return 0;
}
}
}
}
}
{
if(A=='2')
{
system("title 八进制计算器");
system ("color 1c");
int a,b,c,d,e;
while(1)
{
{
system("cls");
printf("==========================================\n");
printf("欢迎使用八进制计算器。\n\n");
printf("输入a:");
scanf("%d",&a);
printf("输入b:");
scanf("%d",&b);
printf("输入底数:\n");
scanf("%d",&c);
printf("输入指数:\n");
scanf("%d",&d);
e=a+b;
printf("和是%o\n",e);
e=a*b;
printf("积是%o\n",e);
e=a-b;
printf("差是%o\t((0.xx)都为0)\n",e);
e=a/b;
printf("商是%o\n",e);
e = pow(c, d);
printf("乘方是%o\n",e);
sleep(1000);
printf("\n\n\n 请问您要再次使用吗? q.使用 其他键.关闭");
printf("\n\n 请输入:");
{
char k;
k=getch();
{
if(k=='q' || k=='q')
{
}
else
{
return 0;
}
}
}
}
}
}
{
if(A=='3')
{
system("title 十六进制计算器");
system ("color 1c");
int a,b,c,d,e;
while(1)
{
{
system("cls");
printf("==========================================\n");
printf("欢迎使用十六进制计算器。\n\n");
printf("输入a:");
scanf("%d",&a);
printf("输入b:");
scanf("%d",&b);
printf("输入底数:\n");
scanf("%d",&c);
printf("输入指数:\n");
scanf("%d",&d);
e=a+b;
printf("和是%x\n",e);
e=a*b;
printf("积是%x\n",e);
e=a-b;
printf("差是%x\n",e);
e=a/b;
printf("商是%x\t((0.xx)都为0)\n",e);
e = pow(c, d);
printf("乘方是%x\n",e);
sleep(1000);
printf("\n\n\n 请问您要再次使用吗? q.使用 其他键.关闭");
printf("\n\n 请输入:");
{
char D;
D=getch();
{
if(D=='q' || D=='q')
{
}
else
{
return 0;
}
}
}
}
}
}
{
if(A=='4')
{
system("cls");
int i;
char s[128];
printf("输入一个数:");
scanf("%d",&i);
itoa(i, s, 2);
printf("该数转换为二进制是: %s\n",s);
sleep(10000);
return 0;
}
}
}
}
}
} |