展开全部
#include <iostream>
#include <string>
class Calculate{
public:
Calculate():a(0),b(0),a_lenth(0),b_lenth(0){}
~Calculate(){}
public:
void show(){std::cout<<result;}
void add(long int i,long int j){
result=i+j;
}
void minus(long int i,long int j){
result=i-j;
}
void multiply(long int i,long int j){
result=i*j;
}
void modu(long int i,long int j){
result=i%j;
}
void reset(){result=0;}
private:
long int a;
int a_lenth;
long int b;
int b_lenth;
long int result;
};
int main(int argc,char * argv[])
{
long int a,b;
std::cout<<"Please enter one:\n";
std::cin>>a;
std::cout<<"Please enter one:\n";
std::cin>>b;
Calculate obj;
obj.add(a,b);
std::cout<<"one + two =";
obj.show();
std::cout<<"\n one - two =";
obj.minus(a,b);
obj.show();
std::cout<<"\n one * two =";
obj.multiply(a,b);
obj.show();
::system("pause");
return 0;
}
#include <string>
class Calculate{
public:
Calculate():a(0),b(0),a_lenth(0),b_lenth(0){}
~Calculate(){}
public:
void show(){std::cout<<result;}
void add(long int i,long int j){
result=i+j;
}
void minus(long int i,long int j){
result=i-j;
}
void multiply(long int i,long int j){
result=i*j;
}
void modu(long int i,long int j){
result=i%j;
}
void reset(){result=0;}
private:
long int a;
int a_lenth;
long int b;
int b_lenth;
long int result;
};
int main(int argc,char * argv[])
{
long int a,b;
std::cout<<"Please enter one:\n";
std::cin>>a;
std::cout<<"Please enter one:\n";
std::cin>>b;
Calculate obj;
obj.add(a,b);
std::cout<<"one + two =";
obj.show();
std::cout<<"\n one - two =";
obj.minus(a,b);
obj.show();
std::cout<<"\n one * two =";
obj.multiply(a,b);
obj.show();
::system("pause");
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询