计算器的C++源代码

来源:百度知道 编辑:UC知道 时间:2024/06/05 02:45:20
各位高手帮下忙吧,要求有图形界面,能进行简单的+-*/四则运算和求百分比运算,通过鼠标输入一个数,单击S按钮还可以计算该数的平方根。急急急!!!有的发我邮箱里吧,麻烦各位啦。
zhoulifei1121@sina.com
程序代码1400行左右……

#include <iostream>
#include <cstdio>

using namespace std;
class jishu
{
public:
jishu();

double a(char );
void b(int,int );

private:

double c;
double e;
char f;
};
jishu::jishu()
{
cout<<"计算器小程序加(+)、减(-)、乘(*)、除(/)"<<endl;
}
double jishu::a(char k)
{
switch (k)
{
case '*':
return c*e;
break;
case '/':
return c/e;
break;
case '+':
return c+e;
break;
case '-':
return c-e;
break;

default:
cout<<"输入错误,请重新输入"<<endl;
while(getchar() != '\n'); //加了1个C格式的清除缓冲区语句

}
}

void jishu::b(int h,int w)
{
c=h;
e=w;

}
void main()
{

jishu ffff;
while(int k=1)
{

double p,m,w; ch