資源簡介
完整的c++語言程序設計鄭莉第四版源代碼下載,內(nèi)容詳實,課后練習做起來美滋滋~~~

代碼片段和文件信息
//4_4.cpp
#include?
#include?
using?namespace?std;
class?Point //Point類聲明
{
public:
Point(int?xx=0?int?yy=0)?
{
X=xx;Y=yy;
//cout<<“Point構(gòu)造函數(shù)被調(diào)用“< }
Point(Point?&p);
int?GetX()?{return?X;}
int?GetY()?{return?Y;}
//~Point() {cout<<“Point析構(gòu)函數(shù)被調(diào)用“< private:
int?XY;
};
Point::Point(Point?&p) //拷貝構(gòu)造函數(shù)的實現(xiàn)
{
X=p.X;
Y=p.Y;
cout<<“Point拷貝構(gòu)造函數(shù)被調(diào)用“< }
//類的組合
class?Line //Line類的聲明
{
public: //外部接口
Line(int?x1int?y1int?x2int?y2);
Line?(Point?xp1?Point?xp2);
/*Line?(Point?xp1?int?x2int?y2):p1(xp1)p2(x2y2)
{
cout<<“混合參數(shù)“< double?x=double(p1.GetX()-x2);
double?y=double(p1.GetY()-y2);
len=sqrt(x*x+y*y);
}*/
Line?(Line?&);
double?GetLen(){return?len;}
// ~Line(){cout<<“Line析構(gòu)函數(shù)被調(diào)用“< private: //私有數(shù)據(jù)成員
Point?p1p2; //Point類的對象p1p2
double?len;
};
//組合類的構(gòu)造函數(shù)
Line::?Line(int?x1int?y1int?x2int?y2)
:p1(x1y1)p2(x2y2)
{
cout<<“Line構(gòu)造函數(shù)被調(diào)用int“< double?x=double(x1-x2);
double?y=double(y1-y2);
len=sqrt(x*x+y*y);
}
Line::?Line?(Point?xp1?Point?xp2)
:p1(xp1)p2(xp2)
{
cout<<“Line構(gòu)造函數(shù)被調(diào)用point“< double?x=double(p1.GetX()-p2.GetX());
double?y=double(p1.GetY()-p2.GetY());
len=sqrt(x*x+y*y);
}
//組合類的拷貝構(gòu)造函數(shù)
Line::?Line?(Line?&Seg):?p1(Seg.p1)?p2(Seg.p2)
{
cout<<“Line拷貝構(gòu)造函數(shù)被調(diào)用“< len=Seg.len;
}
//主函數(shù)
void?main()
{
Point?myp1(11)myp2(45); //建立Point類的對象
Line?line(myp1myp2); //建立Line類的對象
Line?line1(1145);
Line?line2(line); //利用拷貝構(gòu)造函數(shù)建立一個新對象
cout<<“The?length?of?the?line?is:“;
cout< cout<<“The?length?of?the?line1?is:“;
cout< cout<<“The?length?of?the?line2?is:“;
cout< /*Line?line3(myp145);
cout<<“The?length?of?the?line3?is:“;
cout< }
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-10-17?10:39??例題源代碼\
?????文件????????1987??2017-10-17?10:38??例題源代碼\4_4.cpp
?????目錄???????????0??2017-10-17?10:39??例題源代碼\ch02\
?????文件?????????205??2017-10-17?10:39??例題源代碼\ch02\++i---i.cpp
?????文件?????????183??2017-10-17?10:39??例題源代碼\ch02\++i.cpp
?????文件?????????134??2017-10-17?10:39??例題源代碼\ch02\2_1.cpp
?????文件?????????282??2017-10-17?10:39??例題源代碼\ch02\2_10.cpp
?????文件?????????606??2017-10-17?10:39??例題源代碼\ch02\2_11.cpp
?????文件?????????355??2017-10-17?10:39??例題源代碼\ch02\2_12.cpp
?????文件?????????462??2017-10-17?10:39??例題源代碼\ch02\2_13.cpp
?????文件?????????789??2017-10-17?10:39??例題源代碼\ch02\2_14.cpp
?????文件?????????366??2017-10-17?10:39??例題源代碼\ch02\2_2.cpp
?????文件?????????275??2017-10-17?10:39??例題源代碼\ch02\2_3.cpp
?????文件?????????536??2017-10-17?10:39??例題源代碼\ch02\2_4.cpp
?????文件?????????209??2017-10-17?10:39??例題源代碼\ch02\2_5.cpp
?????文件?????????314??2017-10-17?10:39??例題源代碼\ch02\2_6.cpp
?????文件?????????165??2017-10-17?10:39??例題源代碼\ch02\2_7.cpp
?????文件?????????277??2017-10-17?10:39??例題源代碼\ch02\2_8.cpp
?????文件?????????485??2017-10-17?10:39??例題源代碼\ch02\2_9.cpp
?????文件?????????429??2017-10-17?10:38??例題源代碼\ch02\chap2?jiegou?li.cpp
?????文件?????????212??2017-10-17?10:38??例題源代碼\ch02\for?do-while.cpp
?????文件?????????317??2017-10-17?10:38??例題源代碼\ch02\test.cpp
?????文件?????????379??2017-10-17?10:38??例題源代碼\ch02\while?&do?while.cpp
?????文件?????????195??2017-10-17?10:38??例題源代碼\ch02\字符數(shù)據(jù)與整型數(shù)據(jù).cpp
?????目錄???????????0??2017-10-17?10:38??例題源代碼\ch03\
?????文件?????????312??2017-10-17?10:38??例題源代碼\ch03\3_1.cpp
?????文件?????????571??2017-10-17?10:38??例題源代碼\ch03\3_10.cpp
?????文件?????????268??2017-10-17?10:38??例題源代碼\ch03\3_11.cpp
?????文件?????????270??2017-10-17?10:38??例題源代碼\ch03\3_12.cpp
?????文件?????????504??2017-10-17?10:38??例題源代碼\ch03\3_13.cpp
?????文件?????????326??2017-10-17?10:38??例題源代碼\ch03\3_14.cpp
............此處省略326個文件信息
評論
共有 條評論