搜档网
当前位置:搜档网 › C语言计算器源代码

C语言计算器源代码

C语言计算器源代码
C语言计算器源代码

C语言计算器源代码 The latest revision on November 22, 2020

C++语言编写。。

#include

#include

#include

using namespace std;

const double pi = 3.;

const double e = ;

const int SIZE = 1000;

typedef struct node

{

i++;

ge = 0;

biao_dian = 1;

}

if(line[i] == 'P')

{

shu[++p] = pi;

i++;

break;

}

if(line[i] == 'E')

{

shu[++p] = e;

i++;

break;

}

if(flag1)

{

h = h * 10 + (line[i] - '0');

flag = 1;

i++;

if(biao_dian)

ge++;

}

else

break;

}

if(flag)

{

if(biao_dian)

{

int r = 1;

for(int k = 1; k <= ge; k++)

r *= 10;

h /= r;

}

shu[++p] = h; + ^(乘方) F(off) Enter(=) "<

cout<<"对于对数输入 L2_5 表示以2为底5的对数"<

cout<<"M(在前面结果的基础上继续计算,如:上次结果为10,现输入

+*2)"<

cout<<"D(清零并继续输入)"<

cout<<"F(计算机关闭)"<

cout<<"输入 P 就代表输入圆周率, 输入 E 代表输入自然对数

"<

}

void print()

{

system("color 2");

cout<<" 欢迎使用本计算器"<

cout<<"输入一个字符串 on, 计算器开始启动"<

}

void if_start()//是否启动计算器

{

string start;

print();

while(cin>>start)

{

if(start != "on")

{

cout<<"您所输入的字符无效, 请按照介绍的继续输入:"<

continue;

}

else

break;

}

if(start == "on")

{

system("color 5");//颜色的处理

system("cls");//刷屏

}

introduce();//对计算器的简要介绍

cout<<"现在,请输入您所要计算的表达式"<

input();//输入所要计算的表达式

}

int main()

{

if_start();//调用是否启动计算器函数

return 0;

}

相关主题