c++ operator定义一个class > my_int下面提供MAIN函数参数,哪位高手帮我把CLASS完成?int main(void){my_int a,b,c;my_int plus,minus,product,divide,asso;cin >> a;cin >> b;cin >> c;plus = a+b;minus = a-b;product = a*b;divide = a/b;asso =

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 08:12:22
c++ operator定义一个class > my_int下面提供MAIN函数参数,哪位高手帮我把CLASS完成?int main(void){my_int a,b,c;my_int plus,minus,product,divide,asso;cin >> a;cin >> b;cin >> c;plus = a+b;minus = a-b;product = a*b;divide = a/b;asso =
xTj@}ef)^ M@&(IOAB)ԪP*JquY}$۾tuKo9ߙ$뛸wyA:>N'dr{( }Bd2x>$?ݸ}/ݝeWǣlNl0ugcs3?n2p-؍m! H4lšʞ~14l L(&ba l䝰e?_-CU2V^薑+z tez\o7388RFb\YJ%EKVCJ~ b8"m8_u2;agda~XK}OG3$7 b&[Q!" }#[Z}SsDQ~lܮ7F1nC\I+B أa$7jF522S  A..{Lդ`hFPQoPt:f/9-L֨<K+Z^]eՕ+b\uY5@Q ԏ#٧rޟ4K+rʩ" j*\MUXUUX VXLVȣ:꩙GoJ2

c++ operator定义一个class > my_int下面提供MAIN函数参数,哪位高手帮我把CLASS完成?int main(void){my_int a,b,c;my_int plus,minus,product,divide,asso;cin >> a;cin >> b;cin >> c;plus = a+b;minus = a-b;product = a*b;divide = a/b;asso =
c++ operator
定义一个class > my_int
下面提供MAIN函数参数,哪位高手帮我把CLASS完成?
int main(void){
my_int a,b,c;
my_int plus,minus,product,divide,asso;
cin >> a;
cin >> b;
cin >> c;
plus = a+b;
minus = a-b;
product = a*b;
divide = a/b;
asso = a*b-c;
cout

c++ operator定义一个class > my_int下面提供MAIN函数参数,哪位高手帮我把CLASS完成?int main(void){my_int a,b,c;my_int plus,minus,product,divide,asso;cin >> a;cin >> b;cin >> c;plus = a+b;minus = a-b;product = a*b;divide = a/b;asso =
给你一段代码,已经测试过的了,给我最佳啊
#include
#include
using namespace std;
class my_int
{
public:
my_int(){};
my_int (double m)
{
n = m;
}
my_int operator + (const my_int& a);
my_int operator - (const my_int& a);
my_int operator * (const my_int& a);
my_int operator / (const my_int& a);
friend ostream & operator > (istream &,my_int &);
double n;
};
my_int my_int::operator + (const my_int& a)
{
return my_int(n + a.n);
}
my_int my_int::operator - (const my_int& a)
{
return my_int(n - a.n);
}
my_int my_int::operator * (const my_int& a)
{
return my_int(n * a.n);
}
my_int my_int::operator / (const my_int& a)
{
return my_int(n / a.n);
}
ostream & operator >p.n;
return input;
}
int main()
{
my_int a, b, c;
my_int plus, minus, product, divide, asso;
cin >> a;
cin >> b;
cin >> c;
plus = a+b;
minus = a-b;
product = a*b;
divide = a/b;
asso = a*b-c;
cout