用c++builder6.0编写一个计算器程序

来源:百度知道 编辑:UC知道 时间:2024/06/06 05:06:28
只要有一般的功能就行,我是刚入门还不知道怎么弄

#include<iostream.h>
int main()
{int a,b;
char c;
cout<<"enter a"<<endl;
cin>>a;
cout<<"enter c"<<endl;
cin>>c;
cout<<"enter b"<<endl;
cin>>b;
switch(c)
{case '+': cout<<a+b;
case '-':cout<<a-b;
case '*':cout<<a*b;
case '/':cout<<a/b;
default:cout<<"error";
}
return 0;
}
我也是新手,不知道这是不是你想要的。