欢迎光临散文网 会员登陆 & 注册

PSC-3.1.7多功能计算器发布!代码在这里

2022-10-27 19:41 作者:玄冥_丶  | 我要投稿

话不多说,代码放出来:


#include<bits/stdc++.h>

#include<conio.h>

#include<windows.h>

using namespace std;

float pi=3.14;

int m;

int a,lll;

char p; 

int GCD(int num1,int num2)

{

    m=num2;

    if(num1%m==0)

        return m;

    else

    return GCD(m,num1%m);

}

int LCM(int a,int b)

{

    int temp_lcm;

    temp_lcm=a*b/GCD(a,b);

    return temp_lcm;

}

int abc(int n,int m)  

{  

    char aq='A',b; 

if(n==0)  

        return 0;  

    else

    {  

        abc(n/m,m);  

        if(n%m>=10) 

        { 

            b=aq+(n%m-10); 

            cout<<b; 

        } 

        else

            cout<<n%m;  

    }  

}

int main()

{

system("color 3E");

int qxr=0;

int result = MessageBox(NULL,TEXT("是否运行此程序"),TEXT("选择"),MB_ICONQUESTION|MB_YESNO); 

switch (result) 

{

case IDYES:MessageBox(NULL,TEXT("好的,已经为你开始加载"),TEXT("通知"),MB_ICONINFORMATION|MB_OK);qxr=1;break;

case IDNO:MessageBox(NULL,TEXT("好的,已经为你阻止加载"),TEXT("通知"),MB_ICONWARNING|MB_OK);return 0;

}

srand(time(0));

int lll=rand()%10,gks=0;

if (qxr==1)

{

cout<<"中文请输入1,please enter 2 to use English mode:";

int jjjjj;

cin>>jjjjj;

if (jjjjj==1)

{

MessageBox (NULL, "此程序运行量较大,请耐心等候。", "温馨提示:",MB_ICONINFORMATION|MB_OK);

cout<<endl;

if (lll==0)

{

cout<<endl<<endl<<"加载完毕!"<<endl;

gks=1;

}

else

cout<<"你大概需要等待"<<lll<<"秒。";

Sleep (lll*1000);

if (gks==0)

    cout<<"加载完毕!"<<endl;

srand((unsigned)time (NULL));

    int m_cishu;

    int count=1;

    int a_win = 0;

int b_win = 0;

int ping = 0;

cout<<endl;

time_t timep;

char *ch; 

timep=time(NULL);

ch=ctime(&timep);

cout<<"---------------------------------------------------"<<endl;

cout<<"当前时间:"<<ch;

cout<<"________________________________________________________________________________\n";

cout<<"欢迎使用由凌空而上丶创作的C++计算器。在使用中,请不要输入与\n";

cout<<"数学无关的字符,否则可能会引起程序错乱。敬请谅解,谢谢!\n";

for (;;)

{

a=0;

cout<<"________________________________________________________________________________\n";

cout<<"加法请输入1,减法请输入2,乘法请输入3,除法请输入4,(前四项支持小数)求阶乘请输入5,求\n";

cout<<"乘方请输入6,求开根请输入7,求指数请输入8,求最大公因数请输入9,求最小公倍数请输入  \n";

cout<<"10,求绝对值请输入11,求各种公式请输入12,求排序请输入13,求转换进制请输入14(输入'#'\n";

    cout<<"即可结束此程序):";

cin>>a;

    p=a;

    p=getchar();

    cout<<endl;

    

if (a==1)

    {

    float b=0.000,c=0.000,d=0.000;

cout<<"请输入两个加数:"; 

cin>>b>>c;

cout<<endl;

    d=b+c;

    d*=1.000;

    cout<<"结果为"<<d<<endl;

    } 

    

if (a==2)

    {

    float b=0.000,c=0.000,d=0.000;

cout<<"请输入被减数和减数:"; 

cin>>b>>c;

cout<<endl;

    d=b-c;

    d*=1.000;

    cout<<"结果为"<<d<<endl;

    }

    

if (a==3)

    {

    float b=0.00,c=0.00,d=0.0000;

cout<<"请输入两个因数:";

cin>>b>>c;

cout<<endl;

    d=b*c;

    d*=1.0000;

    cout<<"结果为"<<d<<endl;

}

if (a==4)

{

int z;

cout<<"带余数请输入1,带小数请输入2:";

cin>>z;

cout<<endl;

if (z==1)

    float b=0.00,c=0.00,g=0.00;

    int d;

    cout<<"请输入被除数和除数:";

cin>>b>>c;

    cout<<endl;

    d=b/c;

    g=b-d*c;

    d*=1.0000;

    if (g!=0.00)

    cout<<"结果为"<<d<<"......"<<g<<endl;

else

    cout<<"结果为"<<d<<endl;

}

if (z==2)

{

float b=0.00,c=0.00;

double d=0.0000;

cout<<"请输入被除数和除数:"; 

cin>>b>>c;

cout<<endl;

d=b/c;

cout<<"结果为"<<d<<endl;

}

if (z>=3 || z<=0)

{

cout<<"未找到相应的算法\n";

}

}

if (a==5)

{

int e;

long long int f=1;

cout<<"请输入要阶乘的数:";

cin>>e;

cout<<endl;

if (e>20)

    cout<<"此数过大,目前无法计算\n";

else

{

    while (e>=1)

    {

    f*=e;

    e--;

    }

    cout<<"结果为"<<f<<endl;

}

}

if (a==6)

{

    float b=0.0,c=0.0,d=0.00;

cout<<"请输入底数和指数:";

cin>>b>>c;

cout<<endl;

d=pow(b,c);

d*=1.00;

cout<<"结果为"<<d<<endl;

}

if (a==7)

{

float x,y;

double z;

cout<<"请输入要开几根:";

cin>>x;

cout<<endl<<"请输入幂:";

cin>>y;

cout<<endl;

z=pow (y,1.0/x);

cout<<"结果为"<<z<<endl;

}

if (a==8)

{

float m,n;

double i;

cout<<"请输入幂和底数:"; 

cin>>m>>n;

cout<<endl;

i=log(m)/log(n);

cout<<"结果为"<<i<<endl;

}

if (a==9)

{

int N;

            cout<<"请输入要求的数的数量:";

            cin>>N;

            cout<<endl;

            int *arr=new int[N];

            cout<<"请输入想要求的数:";

for(int i=0;i!=N;++i)

                cin >> arr[i];

            for(int i=0;i!=N-1;++i)

            {

    GCD(arr[i],arr[i+1]);

    arr[i+1]=m;

            cout<<"\n他们的最大公因数为"<<arr[N-1]<<endl;

            delete []arr;

}

if (a==10)

{

            int N;

            cout<<"请输入要求的数的数量:";

            cin >> N;

            cout<<endl;

            int *arr = new int[N];

            cout<<"请输入想要求的数:";

for(int i = 0;i!= N; ++i)

                cin >> arr[i];

            int ans = LCM(arr[0], arr[1]);

            for(int  i = 2; i != N; ++i)

                ans = LCM(ans, arr[i]);

            cout << "\n他们的最小公倍数为"<<ans << endl;

            delete []arr;

}

if (a==11)

{

float b=0.000;

cout<<"请输入想要变为绝对值的数:";

cin>>b;

cout<<endl;

cout<<b<<"的绝对值为"<<abs(b)<<endl; 

}

if (a==12)

{

int s;

cout<<"\n求面积请输入1,求三角函数请输入2,求周长请输入3,求体积请输入4,求表面积请输入5:";

cin>>s;

if (s==1)

{

int v;

cout<<"\n矩形请输入1,三角形请输入2,梯形请输入3,平行四边形请输入4,圆形请输入5:";

cin>>v;

cout<<endl;

if (v==1)

{

int dd;

cout<<endl<<"长方形请输入1,正方形请输入2:";

cin>>dd;

cout<<endl;

if (dd==1)

{

cout<<endl<<"请输入长方形的长和宽:";

float aa=0.00,bb=0.00;

cin>>aa>>bb;

cout<<"此长方形面积为"<<aa*bb<<endl;

}

if (dd==2)

{

cout<<endl<<"请输入正方形的边长:";

float aa=0.00;

cin>>aa;

cout<<endl<<"此正方形面积为"<<pow(aa,2)<<endl;

}

if (dd<=0 || dd>=3)

{

               cout<<"未找到相应的图形\n";

            }

               

}

if (v==2)

{

cout<<"请输入三角形的底和高:";

float aa=0.00,bb=0.00;

cin>>aa>>bb;

cout<<endl<<"此三角形的面积为"<<aa*bb/2<<endl;

}

if (v==3)

{

cout<<"请输入梯形的上底,下底和高:";

float aa=0.00,bb=0.00,cc=0.00;

cin>>aa>>bb>>cc;

cout<<endl<<"此梯形的面积为"<<(aa+bb)*cc/2<<endl; 

}

if (v==4)

{

cout<<"请输入平行四边形的底和高:";

float aa=0.00,bb=0.00;

cin>>aa>>bb;

cout<<endl<<"此平行四边形的面积为"<<aa*bb<<endl; 

}

if (v==5)

{

cout<<"请输入圆的半径:";

float aa=0.00;

cin>>aa;

cout<<endl<<"此圆形的面积为"<<pi*pow(aa,2)<<endl; 

}

if (v>=6 || v<=0)

{

cout<<"未找到相应的图形\n";

}

}

if (s==2)

{

cout<<endl<<"\n正弦请输入1,余弦请输入2,正切请输入3,余切请输入4:";

int jj;

cin>>jj;

cout<<endl<<endl;

if (jj==1)

{

cout<<"请输入数:";

int kk;

cin>>kk;

cout<<"\n\n结果为"<<sin(kk)<<endl; 

}

if (jj==2)

{

cout<<"请输入数:";

int kk;

cin>>kk;

cout<<"\n\n结果为"<<cos(kk)<<endl; 

}

if (jj==3)

{

cout<<"请输入数:";

int kk;

cin>>kk;

cout<<"\n\n结果为"<<tan(kk)<<endl; 

}

if (jj==4)

{

cout<<"请输入数:";

int kk;

cin>>kk;

cout<<"\n\n结果为"<<1/tan(kk)<<endl; 

}

if (jj<=0||jj>=5)

{

cout<<"未找到相应的算法\n";

}

}

if (s==3)

{

int v;

cout<<endl<<"\n边数有定值的图形的请输入1,圆形周长请输入2:";

cin>>v;

cout<<endl;

if (v==1)

{

int aaa;

cout<<"请输入边的数量:";

cin>>aaa;

float bbb[aaa]={0.00},sss=0.00;

cout<<"请输入每条边的边长:"; 

for (int jjj=0;jjj<aaa;jjj++)

{

cin>>bbb[jjj];

sss+=bbb[jjj];

}

cout<<endl<<"\n此图形的周长为"<<sss<<endl;

}

if (v==2)

{

float sss=0.00;

cout<<"请输入半径:";

cout<<endl<<"\n此圆的周长为"<<2*pi*sss<<endl;

}

if (v<=0 || v>=3)

{

cout<<"未找到相应的图形\n"; 

}

 

}

if (s==4)

{

cout<<endl<<"\n求立方体的体积请输入1,求球体的体积请输入2,求圆柱体的体积请输入3,求圆锥体的体";

cout<<endl<<"\n积请输入4:" ;

int aaa;

cin>>aaa;

if (aaa==1)

{

cout<<"\n求正方体的体积请输入1,求长方体的体积请输入2:";

int bbb;

cin>>bbb;

    

if (bbb==1)

{

cout<<"\n请输入此正方体的棱长:";

    float ccc=0.00;

    cin>>ccc;

    cout<<endl<<"\n此正方体的体积为"<<pow(ccc,3)<<endl; 

}

if (bbb==2)

{

cout<<"\n请输入此长方体的棱长:";

    float ccc=0.00,ddd=0.00,eee=0.00;

    cin>>ccc>>ddd>>eee;

    cout<<endl<<"\n此长方体的体积为"<<ccc*ddd*eee<<endl; 

}

if (bbb<=0 || bbb>=3)

{

cout<<"未找到相应的立体图形\n";

}

if (aaa==2)

{

cout<<"\n请输入此球体的半径:";

    double ccc,car=0.00;

    cin>>ccc;

    car=4/3*pi*pow(ccc,3)*1.00;

    printf("\n球体的体积为%.2lf\n",car); 

}

if (aaa==3)

{

cout<<"\n请输入此圆柱体底面的半径和此圆柱体的高:";

float xy=0.00,yx=0.00;

cin>>xy>>yx;

cout<<"\n此圆柱体的体积为"<<pi*pow(xy,2)*yx<<endl;

}

if (aaa==4)

{

cout<<"\n请输入此圆锥体底面的半径和此圆锥体的高:";

float xy=0.00,yx=0.00;

cin>>xy>>yx;

cout<<"\n此圆锥体的体积为"<<pi*pow(xy,2)*yx/3<<endl;

}

if (aaa<=0 ||aaa>=5)

{

cout<<"未找到相应的图形\n";

}

}

if(s==5)

{

int ab;

cout<<endl<<"\n求立方体表面积请输入1,求球体表面积请输入2,求金字塔形表面积请输入3,求圆柱体表";

cout<<endl<<"\n面积请输入4,求圆锥体表面积请输入5:" ;

cin>>ab;

if (ab==1)

{

cout<<endl<<"\n求正方体表面积请输入1,求长方体表面积请输入2:";

int bc;

cin>>bc;

if (bc==1)

{

cout<<endl<<"\n请输入此正方体的棱长:";

float cd=0.00;

cin>>cd;

cout<<"\n此正方体的表面积为"<<6*pow(cd,2)<<endl;

}

if (bc==2)

{

cout<<endl<<"\n请输入此长方体的长,宽和高:";

float cd=0.00,de=0.00,ef=0.00;

cin>>cd>>de>>ef;

cout<<"\n此长方体的表面积为"<<2*(cd*de+de*ef+cd*ef)<<endl;

}

if (bc<=0 || bc>=3)

{

cout<<"未找到相应的立体图形\n";

}

}

if (ab==2)

{

float bc=0.00;

cout<<"\n请输入此球体的半径:";

cin>>bc;

cout<<"\n此球体的表面积为"<<4*pi*pow(bc,2)<<endl;

}

if (ab==3)

{

int bc,cd;

cout<<"\n请输入此金字塔形体底面的边长和此金字塔形体上四个三角形的高:";

cin>>bc>>cd;

cout<<"\n此金字塔形体的表面积为"<<pow(bc,2)+2*bc*cd<<endl; 

}

if (ab==4)

{

cout<<"\n请输入此圆柱体底面的半径和此圆柱体的高:";

float xy=0.00,yx=0.00;

cin>>xy>>yx;

cout<<"\n此圆柱体的表面积为"<<2*pi*(xy*yx+pow(xy,2))<<endl;

}

if (ab==5)

{

cout<<"\n请输入此圆锥体底面的半径、此圆锥体的高和其展开图中扇形的圆心角度数:";

float xy=0.00,yx=0.00,yz=0.00;

cin>>xy>>yx>>yz;

cout<<"\n此圆锥体的表面积为"<<pi*(pow(xy,2)+yz/360*pow(yx,2))<<endl;

}

if (ab<=0 || ab>6)

{

cout<<"未找到相应的立体图形\n";

}

}

}

if (a==13)

{

    cout<<"降序排列请输入1,升序排列请输入2:";

int aaaa;

cin>>aaaa;

if (aaaa==1)

{

int i,j,n,t,a[30]={0};

            cout<<"\n请输入需要排列的数的个数:";

cin>>n;

            cout<<"\n请输入需要排列的数:"; 

for(i=1;i<=n;i++)

                cin>>a[i];

            for(i=1;i<=n-1;i++)

                    for(j=n;j>i;j--)

                        if(a[j]>a[j-1])

                        {

                            swap (a[j],a[j-1]);

                }

            cout<<"\n降序排列为:"; 

for(i=1;i<=n;i++)

                cout<<a[i]<<" ";

            cout<<endl;

if (aaaa==2)

{

int i,j,n,t,a[30]={0};

            cout<<"\n请输入需要排列的数的个数:";

cin>>n;

            cout<<"\n请输入需要排列的数:"; 

for(i=1;i<=n;i++)

                cin>>a[i];

            for(i=1;i<=n-1;i++)

                    for(j=n;j>i;j--)

                        if(a[j]<a[j-1])

                        {

                            swap (a[j],a[j-1]);

                }

            cout<<"\n升序排列为:"; 

for(i=1;i<=n;i++)

                cout<<a[i]<<" ";

            cout<<endl;

}

if (a==14)

{

char NUM[50];

    int JZ ;

int v10 = 0;

int y = 0;

cout << "请输入该数的进制:";

cin >> JZ;

cout << "\n请输入要转换的数:";

cin >> NUM;

for (int i = strlen(NUM) - 1; i >= 0; i--) 

{

if (JZ == 16)

{

char x = NUM[i];

int e = 0;

if (x =='A' || x == 'a') 

{

e = 10;

}

else

if (x == 'B' || x == 'b')

{

e = 11;

}

else

if (x == 'C' || x == 'c') 

{

e = 12;

}

else

if (x == 'D' || x == 'd') 

{

e = 13;

}

else

if (x == 'E' || x == 'e') 

{

e = 14;

}

else

if (x == 'F' || x == 'f') 

{

e = 15;

}

else

{

e = NUM[i] - '0';

}

v10 = v10 + e*pow(JZ, y);

}

else 

{

int x = NUM[i] - '0';

v10 = v10 + x * pow(JZ, y);

}

y++;

}

long long int bbb=v10,zzz;

int flag;

flag=0;

cout<<"\n请输入想要转换的进制:";

int xxx;

cin>>xxx;

cout<<"\n进制转换后的值为:";

if(bbb==0) 

                cout<<"0"<<endl; 

            else

            { 

                if(bbb<0) 

                { 

                    xxx*=-1;

                    cout<<"-";

                } 

                abc(bbb,xxx); 

                cout<<endl; 

            } 

}

if (p=='#')

{

    cout<<"好的,已经为您结束程序。\n"; 

break;

}

if (a>=15 || a<=0)

{

cout<<"未找到相应的算法,请重新输入\n"; 

}

}

Sleep(2500);

cout<<"\n\n感谢使用,";

Sleep(2500);

cout<<"目前此智能计算器还处于试验阶段,";

Sleep(2500);

cout<<"我们会尽快推出更高级的设备!";

Sleep(2500);

cout<<"\n\n                                                            ——凌空而上丶"; 

}

if (jjjjj==2)

{

MessageBox (NULL, "This program runs a large amount, please wait patiently.", "Reminder:",MB_ICONINFORMATION|MB_OK);

cout<<endl;

if (lll==1)

    cout<<"You probably need to wait for about "<<lll<<" second.";

else if (lll==0)

{

    cout<<"Loading completed!"<<endl;

    gks=1;

}

else

cout<<"You probably need to wait for about "<<lll<<" seconds.";

Sleep (lll*1000);

if (gks==0)

cout<<endl<<endl<<"Loading completed!"<<endl;

srand((unsigned)time (NULL));

    int m_cishu;

    int count=1;

    int a_win = 0;

int b_win = 0;

int ping = 0;

cout<<endl;

time_t timep;

char *ch; 

timep=time(NULL);

ch=ctime(&timep);

cout<<"---------------------------------------------------"<<endl;

cout<<"time:"<<ch;

cout<<"________________________________________________________________________________\n";

cout<<"Welcome to the Perfect Super Calculator created by the \n";

cout<<"LKES\ Studio.In use,please do not enter things which are not related to     \n";

cout<<"maths,or you may cause program confusion.Please understand,thank you!\n";

for (;;)

{

a=0;

cout<<"________________________________________________________________________________\n";

cout<<"Please enter 1 for addition, 2 for subtraction, 3 for multiplication, 4 for     \n";

cout<<"division, (the first four items support decimals) 5 for factorial,6 for power,7 \n";

cout<<"for open root, 8 for exponent,9 for maximum common factor,10 to find the least  \n";

    cout<<"common multiple, 11 to find the absolute value, 12 to find various formulas, 13 \n";

    cout<<"to find the sorting, and 14 to find the conversion base (enter '#' to end the   \n";

    cout<<"program):";

cin>>a;

    p=a;

    p=getchar();

    cout<<endl;

    

if (a==1)

    {

    float b=0.000,c=0.000,d=0.000;

cout<<"Please enter two addends:"; 

cin>>b>>c;

cout<<endl;

    d=b+c;

    d*=1.000;

    cout<<"The result is "<<d<<endl;

    } 

    

if (a==2)

    {

    float b=0.000,c=0.000,d=0.000;

cout<<"Please enter the minuend and the subtraction:"; 

cin>>b>>c;

cout<<endl;

    d=b-c;

    d*=1.000;

    cout<<"The result is "<<d<<endl;

    }

    

if (a==3)

    {

    float b=0.00,c=0.00,d=0.0000;

cout<<"Please enter two factors:";

cin>>b>>c;

cout<<endl;

    d=b*c;

    d*=1.0000;

    cout<<"The result is "<<d<<endl;

}

if (a==4)

{

int z;

cout<<"Please enter 1 with remainder and 2 with decimal:";

cin>>z;

cout<<endl;

if (z==1)

    float b=0.00,c=0.00,g=0.00;

    int d;

    cout<<"Please enter the divisor and divisor:";

cin>>b>>c;

    cout<<endl;

    d=b/c;

    g=b-d*c;

    d*=1.0000;

    if (g!=0.00)

    cout<<"The result is "<<d<<"......"<<g<<endl;

else

    cout<<"The result is "<<d<<endl;

}

if (z==2)

{

float b=0.00,c=0.00;

double d=0.0000;

cout<<"Please enter the divisor and divisor:"; 

cin>>b>>c;

cout<<endl;

d=b/c;

cout<<"The result is "<<d<<endl;

}

if (z>=3 || z<=0)

{

cout<<"The corresponding algorithm was not found\n";

}

}

if (a==5)

{

int e;

long long int f=1;

cout<<"Please enter the number to factorial:";

cin>>e;

cout<<endl;

if (e>20)

    cout<<"This number is too large to calculate at present\n";

else

{

    while (e>=1)

    {

    f*=e;

    e--;

    }

    cout<<"The result is "<<f<<endl;

}

}

if (a==6)

{

    float b=0.0,c=0.0,d=0.00;

cout<<"Please enter base and index:";

cin>>b>>c;

cout<<endl;

d=pow(b,c);

d*=1.00;

cout<<"The result is "<<d<<endl;

}

if (a==7)

{

float x,y;

double z;

cout<<"Please enter the root of the power to open:";

cin>>x;

cout<<endl<<"Please enter power:";

cin>>y;

cout<<endl;

z=pow (y,1.0/x);

cout<<"The result is "<<z<<endl;

}

if (a==8)

{

float m,n;

double i;

cout<<"Please enter the power and the base:"; 

cin>>m>>n;

cout<<endl;

i=log(m)/log(n);

cout<<"The result is "<<i<<endl;

}

if (a==9)

{

int N;

            cout<<"Please enter the quantity of the number:";

            cin>>N;

            cout<<endl;

            int *arr=new int[N];

            cout<<"Please enter the numbers:";

for(int i=0;i!=N;++i)

                cin >> arr[i];

            for(int i=0;i!=N-1;++i)

            {

    GCD(arr[i],arr[i+1]);

    arr[i+1]=m;

            cout<<"\nTheir greatest common factor is "<<arr[N-1]<<endl;

            delete []arr;

}

if (a==10)

{

            int N;

            cout<<"Please enter the quantity of the number:";

            cin >> N;

            cout<<endl;

            int *arr = new int[N];

            cout<<"Please enter the numbers:";

for(int i = 0;i!= N; ++i)

                cin >> arr[i];

            int ans = LCM(arr[0], arr[1]);

            for(int  i = 2; i != N; ++i)

                ans = LCM(ans, arr[i]);

            cout << "\nTheir least common multiple is "<<ans << endl;

            delete []arr;

}

if (a==11)

{

float b=0.000;

cout<<"Please enter the number that will become its absolute number:";

cin>>b;

cout<<endl;

cout<<"The absolute value of "<<b<<"is "<<abs(b)<<endl; 

}

if (a==12)

{

int s;

cout<<"\nPlease enter 1 for area, 2 for trigonometric function, 3 for perimeter, 4 for\n";

cout<<"\nvolume and 5 for surface area:";

cin>>s;

if (s==1)

{

int v;

cout<<"\nPlease enter 1 for rectangle, 2 for triangle, 3 for trapezoid, 4 for\n";

cout<<"\nparallelogram and 5 for circle:";

cin>>v;

cout<<endl;

if (v==1)

{

int dd;

cout<<endl<<"Please enter 1 for rectangle and 2 for square:";

cin>>dd;

cout<<endl;

if (dd==1)

{

cout<<endl<<"Please enter the length and width of the rectangle:";

float aa=0.00,bb=0.00;

cin>>aa>>bb;

cout<<"The area of this rectangle is "<<aa*bb<<endl;

}

if (dd==2)

{

cout<<endl<<"Please enter the side length of the square:";

float aa=0.00;

cin>>aa;

cout<<endl<<"The area of this square is "<<pow(aa,2)<<endl;

}

if (dd<=0 || dd>=3)

{

               cout<<"The corresponding drawing was not found\n";

            }

               

}

if (v==2)

{

cout<<"Please enter the base and height of the triangle:";

float aa=0.00,bb=0.00;

cin>>aa>>bb;

cout<<endl<<"The area of this triangle is "<<aa*bb/2<<endl;

}

if (v==3)

{

float aa=0.00,bb=0.00,cc=0.00;

cout<<"Please enter the upper side length, lower side length and height of the\n";

cout<<"\ntrapezoid:";

cin>>aa>>bb>>cc;

cout<<endl<<"The area of this trapezoid is "<<(aa+bb)*cc/2<<endl; 

}

if (v==4)

{

cout<<"Please enter the base and height of the parallelogram:";

float aa=0.00,bb=0.00;

cin>>aa>>bb;

cout<<endl<<"The area of this parallelogram is "<<aa*bb<<endl; 

}

if (v==5)

{

cout<<"Please enter the radius of the circle:";

float aa=0.00;

cin>>aa;

cout<<endl<<"The area of this circle is "<<pi*pow(aa,2)<<endl; 

}

if (v>=6 || v<=0)

{

cout<<"The corresponding drawing was not found\n";

}

}

if (s==2)

{

cout<<endl<<"\nPlease enter 1 for sine, 2 for cosine, 3 for tangent and 4 for cotangent:";

int jj;

cin>>jj;

cout<<endl<<endl;

if (jj==1)

{

cout<<"Please enter the number:";

int kk;

cin>>kk;

cout<<"\n\nThe result is "<<sin(kk)<<endl; 

}

if (jj==2)

{

cout<<"Please enter the number:";

int kk;

cin>>kk;

cout<<"\n\nThe result is "<<cos(kk)<<endl; 

}

if (jj==3)

{

cout<<"Please enter the number:";

int kk;

cin>>kk;

cout<<"\n\nThe result is "<<tan(kk)<<endl; 

}

if (jj==4)

{

cout<<"Please enter the number:";

int kk;

cin>>kk;

cout<<"\n\nThe result is "<<1/tan(kk)<<endl; 

}

if (jj<=0||jj>=5)

{

cout<<"The corresponding algorithm was not found\n";

}

}

if (s==3)

{

int v;

cout<<endl<<"\nPlease enter 1 for the figure with a fixed number of edges and 2 for the \n";

cout<<"\ncircumference of the circle:";

cin>>v;

cout<<endl;

if (v==1)

{

int aaa;

cout<<"Please enter the number of edges:";

cin>>aaa;

float bbb[aaa]={0.00},sss=0.00;

cout<<"Please enter the side length of each side:"; 

for (int jjj=0;jjj<aaa;jjj++)

{

cin>>bbb[jjj];

sss+=bbb[jjj];

}

cout<<endl<<"\nThe perimeter of this drawing is "<<sss<<endl;

}

if (v==2)

{

float sss=0.00;

cout<<"Please enter the radius:";

cout<<endl<<"\nThe circumference of this circle is "<<2*pi*sss<<endl;

}

if (v<=0 || v>=3)

{

cout<<"The corresponding drawing was not found\n"; 

}

 

}

if (s==4)

{

cout<<endl<<"\nPlease enter 1 for the volume of the cube,enter 2 for the volume of the sphere,\n";

cout<<endl<<"\nenter 3 for the volume of the cylinder,enter 4 for the volume of the cone:" ;

int aaa;

cin>>aaa;

if (aaa==1)

{

cout<<"\nPlease enter 1 for the volume of the cube,and enter 2 for the volume of the box:";

int bbb;

cin>>bbb;

    

if (bbb==1)

{

cout<<"\nPlease enter the edge length of this cube:";

    float ccc=0.00;

    cin>>ccc;

    cout<<endl<<"\nThe volume of this cube is "<<pow(ccc,3)<<endl; 

}

if (bbb==2)

{

cout<<"\nPlease enter the length, width and height of this box:";

    float ccc=0.00,ddd=0.00,eee=0.00;

    cin>>ccc>>ddd>>eee;

    cout<<endl<<"\nThe volume of this box is "<<ccc*ddd*eee<<endl; 

}

if (bbb<=0 || bbb>=3)

{

cout<<"The corresponding stereo shape was not found\n";

}

if (aaa==2)

{

cout<<"\nPlease enter the radius of this sphere:";

    double ccc,car=0.00;

    cin>>ccc;

    car=4/3*pi*pow(ccc,3)*1.00;

    printf("\nThe volume of the sphere is %.2lf\n",car); 

}

if (aaa==3)

{

float xy=0.00,yx=0.00;

cout<<"\nPlease enter the radius of the bottom of this cylinder and the height of this\n";

cout<<"\ncylinder:";

cin>>xy>>yx;

cout<<"\nThe volume of this cylinder is "<<pi*pow(xy,2)*yx<<endl;

}

if (aaa==4)

{

float xy=0.00,yx=0.00;

cout<<"\nPlease enter the radius of the bottom of this cone and the height of this\n";

cout<<"\ncone:";

cin>>xy>>yx;

cout<<"\nThe volume of this cone is "<<pi*pow(xy,2)*yx/3<<endl;

}

if (aaa<=0 ||aaa>=5)

{

cout<<"The corresponding drawing was not found\n";

}

}

if(s==5)

{

int ab;

cout<<endl<<"\nEnter 1 for cube surface area, 2 for sphere surface area, 3 for pyramid surface\n";

cout<<endl<<"\narea, 4 for cylinder surface area, and 5 for cone surface area:" ;

cin>>ab;

if (ab==1)

{

cout<<endl<<"\nPlease enter 1 for cube surface area and 2 for box surface area:";

int bc;

cin>>bc;

if (bc==1)

{

cout<<endl<<"\nPlease enter the edge length of this cube:";

float cd=0.00;

cin>>cd;

cout<<"\nThe surface area of this cube is "<<6*pow(cd,2)<<endl;

}

if (bc==2)

{

cout<<endl<<"\nPlease enter the length, width and height of this box:";

float cd=0.00,de=0.00,ef=0.00;

cin>>cd>>de>>ef;

cout<<"\nThe surface area of this box is "<<2*(cd*de+de*ef+cd*ef)<<endl;

}

if (bc<=0 || bc>=3)

{

cout<<"The corresponding stereo shape was not found\n";

}

}

if (ab==2)

{

float bc=0.00;

cout<<"\nPlease enter the radius of this sphere:";

cin>>bc;

cout<<"\nThe surface area of this sphere is "<<4*pi*pow(bc,2)<<endl;

}

if (ab==3)

{

int bc,cd;

cout<<"\nPlease enter the side length of the bottom surface of this pyramid and the\n";

cout<<"\nheight of the four triangles on this pyramid:";

cin>>bc>>cd;

cout<<"\nThe surface area of this pyramid is "<<pow(bc,2)+2*bc*cd<<endl; 

}

if (ab==4)

{

cout<<"\nPlease enter the radius of the bottom of this cylinder and the height of this\n";

cout<<"\ncylinder:";

float xy=0.00,yx=0.00;

cin>>xy>>yx;

cout<<"\nThe surface area of this cylinder is "<<2*pi*(xy*yx+pow(xy,2))<<endl;

}

if (ab==5)

{

cout<<"\nPlease enter the radius of the bottom of the cone, the height of the cone and\n";

cout<<"\nthe center angle of the sector in its expanded view:";

float xy=0.00,yx=0.00,yz=0.00;

cin>>xy>>yx>>yz;

cout<<"\nThe surface area of this cone is "<<pi*(pow(xy,2)+yz/360*pow(yx,2))<<endl;

}

if (ab<=0 || ab>6)

{

cout<<"The corresponding stereo shape was not found\n";

}

}

}

if (a==13)

{

    cout<<"Please enter 1 for descending order and 2 for ascending order:";

int aaaa;

cin>>aaaa;

if (aaaa==1)

{

int i,j,n,t,a[30]={0};

            cout<<"\nPlease enter the amount of numbers to be arranged:";

cin>>n;

            cout<<"\nPlease enter the number to arrange:"; 

for(i=1;i<=n;i++)

                cin>>a[i];

            for(i=1;i<=n-1;i++)

                    for(j=n;j>i;j--)

                        if(a[j]>a[j-1])

                        {

                            swap (a[j],a[j-1]);

                }

            cout<<"\nIn descending order:"; 

for(i=1;i<=n;i++)

                cout<<a[i]<<" ";

            cout<<endl;

if (aaaa==2)

{

int i,j,n,t,a[30]={0};

            cout<<"\nPlease enter the amount of numbers to be arranged:";

cin>>n;

            cout<<"\nPlease enter the number to arrange:"; 

for(i=1;i<=n;i++)

                cin>>a[i];

            for(i=1;i<=n-1;i++)

                    for(j=n;j>i;j--)

                        if(a[j]<a[j-1])

                        {

                            swap (a[j],a[j-1]);

                }

            cout<<"\nIn ascending order:"; 

for(i=1;i<=n;i++)

                cout<<a[i]<<" ";

            cout<<endl;

}

if (a==14)

{

char NUM[50];

    int JZ ;

int v10 = 0;

int y = 0;

cout << "Please enter the hexadecimal of the number:";

cin >> JZ;

cout << "\nPlease enter the number of to convert:";

cin >> NUM;

for (int i = strlen(NUM) - 1; i >= 0; i--) 

{

if (JZ == 16)

{

char x = NUM[i];

int e = 0;

if (x =='A' || x == 'a') 

{

e = 10;

}

else

if (x == 'B' || x == 'b')

{

e = 11;

}

else

if (x == 'C' || x == 'c') 

{

e = 12;

}

else

if (x == 'D' || x == 'd') 

{

e = 13;

}

else

if (x == 'E' || x == 'e') 

{

e = 14;

}

else

if (x == 'F' || x == 'f') 

{

e = 15;

}

else

{

e = NUM[i] - '0';

}

v10 = v10 + e*pow(JZ, y);

}

else 

{

int x = NUM[i] - '0';

v10 = v10 + x * pow(JZ, y);

}

y++;

}

long long int bbb=v10,zzz;

int flag;

flag=0;

cout<<"\nPlease enter the hexadecimal you want to convert:";

int xxx;

cin>>xxx;

cout<<"\nThe value after hexadecimal conversion is ";

if(bbb==0) 

                cout<<"0"<<endl; 

            else

            { 

                if(bbb<0) 

                { 

                    xxx*=-1;

                    cout<<"-";

                } 

                abc(bbb,xxx); 

                cout<<endl; 

            }

}

if (p=='#')

{

    cout<<"OK, now the program has been finished for you.\n"; 

break;

}

if (a>=15 || a<=0)

{

cout<<"No corresponding algorithm found, please re-enter\n"; 

}

}

Sleep(2500);

cout<<"\n\nThanks for using.";

Sleep(2500);

cout<<"\n\nAt present, this intelligent calculator is still in the experimental stage.";

Sleep(2500);

cout<<"\n\nWe will launch more advanced equipment as soon as possible!";

Sleep(2500);

cout<<"\n\n                                            ——LKES\""; 

}

if (jjjjj<=0 || jjjjj>=3)

{

cout<<"\n未找到对应的语言\n\nThe corresponding language was not found\n";

}

cout<<endl<<endl;

system("pause");

return 0;

}

想用的可以直接拷贝用哦!

希望我的程序能帮助到您!

如果喜欢不妨点一赞支持一下吧

PSC-3.1.7多功能计算器发布!代码在这里的评论 (共 条)

分享到微博请遵守国家法律