# C++编写一个加减乘除开方乘方计算器

#include<iostream>
#include<cmath>
using namespace std;
{
cout<<a+b<<endl;
}
void Subtraction(double a,double b)
{
if(a>b)
cout<<a-b<<endl;
else
cout<<"-"<<b-a<<endl;
}
void Multiplication(double a,double b)
{
cout<<a*b<<endl;
}
void Division(double a,double b)
{
cout<<a/b<<endl;
}
void Root(double a)
{
cout<<sqrt(a)<<endl;
}
void Involution(double a,double b)
{
cout<< pow(a,b)<<endl;
}
int main()
{
int x;
double a = 0.0,b = 0.0;
cout<<"0代表加法\n"<<"1代表减法\n"<<"2代表乘法\n"<<"3代表除法\n"<<"4代表根号\n"<<"5代表平方\n"<<"6代表退出计算\n"<<endl;
cout<<"请输入计算方式的代号:\t";
cin>>x;

cout<<"已为您转入计算空间"<<x<<"."<<endl;
do
{
switch(x)
{
case 0:
{
cout<<"请输入:\t";
cin>>a>>b;
break;
}
case 1:
{
cout<<"请输入:\t";
cin>>a>>b;
Subtraction(a,b);
break;
}
case 2:
{
cout<<"请输入:\t";
cin>>a>>b;
Multiplication(a,b);
break;
}
case 3:
{
cout<<"请输入:\t";
cin>>a>>b;
Division(a,b);
break;
}
case 4:
{
cout<<"请输入:\t";
cin>>a;
Root(a);
break;
}
case 5:
{
cout<<"请输入:\t";
cin>>a>>b;
Involution(a,b);
break;
}
case 6:
break;
}
}
while(x);
}



03-09 98

03-25 667

12-30 5921

05-13 778

05-22 30

07-15

09-26

02-03 3755

07-13

10-14

03-24

12-08 74

03-30

05-23 80

03-02

04-14 59万+

03-13 15万+

03-04 13万+

03-05 6311

03-08 5万+

03-08 7万+

03-10 13万+

03-12 11万+

03-13 11万+

03-14 1万+

03-18 5813

03-18 9746

03-19 3万+

03-19 8万+

03-20 8849

03-24 3万+

03-25 3万+

05-08 5万+

03-25 9万+

03-29 21万+

03-29 1万+

03-29 10万+

03-30 16万+

05-28 6065

05-28 1万+

04-02 4万+

04-03 3445

04-06 7万+

04-07 5万+

04-09 8万+

04-09 2万+

05-17 8416

04-10 2839

04-11 3万+

04-15 6万+

04-18 4万+

04-20 4万+

04-24 3万+

04-29 6246

04-29 7011

04-30 4896

04-30 9949

04-30 9511

05-16 5万+

05-08 4万+

05-11 3万+

05-12 1万+

05-13 705

05-14 6405

05-14 1938

05-16 1万+

05-20 953

05-18 8352

05-27 1344

05-18 3532

05-19 1万+

05-21 7294

05-21 7327

05-25 5246

05-22 358

05-23 1万+

05-23 6493

05-24 1693

#### 自律不熬夜真的那么难吗？

©️2019 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客