C++?е??????????
???????????? ???????[ 2015/5/20 13:39:14 ] ???????????????
?????????????????????
??????????????????????????“??????”??“????”???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????ν????????????
????#include <iostream>
????using namespace std;
????int main()
????{
????int a = 2 ?? b = 3;
????float c = 2.1f ?? d = 1.2f;
????cout<<"a + b = "<<a+b<<endl;
????cout<<"c + d = "<<c+d<<endl;
????return 0;
????}
?????????????????“+”???float??int?????????????????????????????????Щ??????????????????????????????????????????????д????????????????????????????????????????????????????????????point?????????????????????????????????????????????????д???????????????????
#include <iostream>
using namespace std;
class point
{
double x;
double y;
public:
double get_x()
{
return x;
}
double get_y()
{
return y;
}
point(double X = 0.0 ?? double Y = 0.0):x(X)??y(Y){};
point operator +(point p);
};
//?????????“+”
point point::operator +(point p)
{
double x = this->x + p.x;
double y = this->y + p.y;
point tmp_p(x??y);
return tmp_p;
}
int main()
{
point p1(1.2??3.1);
point p2(1.1??3.2);
point p3 = p1+p2;
cout<<p3.get_x()<<" "<<p3.get_y()<<endl;
return 0;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11