别叫我猪蛋 别叫我猪蛋
关注数: 88 粉丝数: 111 发帖数: 17,543 关注贴吧数: 12
庆祝我凯逆袭成功,特发代码贴! #include<iostream> using namespace std;class Complex { private: void show(); double re; double im; public: Complex(){re=0;im=0;} ~Complex(){} Complex(double a,double b){re=a;im=b;} double realPart(){return re;} double imagPart(){return im;} Complex operator +(Complex &other); Complex operator +(const double &other); Complex operator +(const int &other); Complex operator /(Complex &other); Complex operator /(const double &other); Complex operator /(const int &other); Complex operator =(Complex &other); bool operator ==(Complex &other); bool operator !=(Complex &other); friend ostream& operator<<(ostream &os,Complex &other); friend istream& operator>>(istream &is,Complex &other); };void Complex::show() { if(re>0&&im<0) printf("%.1f%.1fj",re,im); else if(re>0&&im>0) printf("%.1f+%.1fj",re,im); else if(re<0&&im>0) printf("%.1f+%.1fj",re,im); else if(re<0&&im<0) printf("%.1f%.1fj",re,im); else if(re==0&&im!=0) printf("%.1fj",im); else if(re!=0&&im==0) printf("%.1f",re); else printf("0"); } Complex Complex::operator+(Complex &other) { Complex temp; temp.re=re+other.re; temp.im=im+other.im; return temp; }Complex Complex::operator +(const double &other) { Complex temp; temp.re=re+other; temp.im=im; return temp; }Complex Complex::operator +(const int &other) { Complex temp; temp.re=re+(double)other; temp.im=im; return temp; } Complex Complex::operator/(Complex &other) { Complex temp; temp.re=((re*other.re)+(im*other.im))/(other.re*other.re+other.im*other.im); temp.im=((im*other.re)-(re*other.im))/(other.re*other.re+other.im*other.im); return temp;}Complex Complex::operator /(const double &other) { Complex temp; temp.re=re/other; temp.im=im/other; return temp; }Complex Complex::operator /(const int &other) { Complex temp; temp.re=re/(double)other; temp.im=im/(double)other; return temp; }Complex Complex::operator= (Complex &other) { this->re=other.re; this->im=other.im; return *this;} bool Complex::operator ==(Complex &other) { if(this->re==other.re&&this->im==other.im) return true; else return false; } bool Complex::operator !=(Complex &other) { if(this->re!=other.re ||this->im!=other.im) return true; else return false; }ostream& operator<<(ostream &os,Complex &other) { other.show(); return cout; }istream& operator>>(istream &is,Complex &other) { is>>other.re; is>>other.im; return cin; } /*main*/ #include <iostream> #include "Complex.h" using namespace std;int main() { Complex n1(1,2.5),n2(3,2.5),n3; cout <<"n1:"<<n1<<endl; cout <<"n2:"<<n2<<endl; cout <<"n3:"<<n3<<endl; cout <<"n1+n2:"<<n1+n2<<endl; cout <<"Enter n1 and n2: "; cin >> n1 >> n2; cout <<"n1:"<<n1<<endl; cout <<"n2:"<<n2<<endl; cout <<"n1/n2:"<<n1/n2<<endl; cout <<"realPart of n1:"<<n1.realPart()<<endl; cout <<"imagPart of n1:"<<n1.imagPart()<<endl; cout <<"|n2|:"<<n2<<endl; n2.realPart()+=10; n2.imagPart()-=10; cout <<"n2 After modifying:"<<n2<<endl; return 0; }
快船这节奏不对啊,这尼玛是要得总冠军啊!! 北京时间12月13日消息,100-94,快船[微博]客场战胜山猫,豪取8连胜。快船的8连胜已经追平了他们球队21年前创造的队史连胜纪录。眼下的这支快船,早已经不是昔日的鱼腩。如果他们继续保持这样的上升态势,谁敢说总冠军奖杯不会落入这支史上最强的快船手中呢?   场均攻下101.9分,排名全联盟第6;场均失分94.2分,排名全联盟第7。助攻、抢断和盖帽也都排进了联盟前十。现在的快船不是攻守乏力的西部弱旅,无论是进攻和防守,他们都打得有声有色。当然,有了保罗、格里芬[微博]、克劳福德这样的得分能手,快船已经注定是一支进攻强队,但是,这并不是他们想要的身份。“我们希望自己的身份是一种防守的身份,我们仍在努力去确定这种身份,”赛前,克里斯-保罗[微博]说,“防守才能帮助我们保证比赛的胜利。”   过去这波8连胜,快船体现了自己在防守上的进步。8个对手,他们只让犹他爵士队的得分破百,其中三支球队的得分甚至被快船限制在90分以下。压迫性的进攻,带来了压迫性的防守,快船自成一派的攻防体系,成为最近一段时间联盟里的焦点。他们不再是那支纯观赏性的球队,目不暇接的空中大灌篮,已经成为胜利旋律中的插曲,而不是快船比赛的主题。   对山猫的这场比赛,快船再次体现了强队的风貌。整场比赛,他们都牢牢地控制着领先的优势,即便对方替补的得分能力一点也不逊色于快船,但是快船赢球靠的是整体,靠的是团队进攻。真正的强队不是靠一两个点在进攻,而是任何一名球员都可能成为球队的得分王。克劳福德、巴特勒、保罗、巴恩斯、格里芬……在22场比赛中,他们都曾经成为球队的单场得分王,也正是这样广布的得分点,让快船成为全联盟最难对付的球队之一。   现在的快船,正在提速冲向他们的目标——总冠军奖杯。他们的信念很坚定,要把这座奖杯带回洛杉矶。只不过,这一次LA的背后不再写着湖人
1 下一页