
每天一个C++小程序
OneBaBa
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
(三 )运算符重载
#include "stdafx.h" #include using namespace std; class Point { int x,y; public: Point(int x1=0,int y1=0){x=x1;y=y1;} friend istream & operator >>(istream & input,Point & obj); friend ostream &翻译 2014-10-31 16:24:19 · 598 阅读 · 0 评论 -
(一)计算两点之间的距离(友元函数)
#include #include #define OK 1 using namespace std; class Point { public: Point(int xx=0,int yy=0) { X=xx; Y=yy; } int GetX() { return X; } int GetY() { return Y; } friend float转载 2014-10-16 10:19:41 · 7721 阅读 · 1 评论 -
(二)矩形类求面积
第一种方案: [cpp] view plaincopyprint? #include using namespace std; class Juxing { public: Juxing(int Hwidth,int Hheight); ~Juxing() {} int G转载 2014-10-17 14:14:37 · 977 阅读 · 0 评论 -
(四)模板-排序sort
#include using namespace std; template void sort(T s[],int n) { int i,j; T temp; for(i=1;i { j=i; temp=s[i]; while(j>0&&temp { s[j]=s[j-1]; j--; } s[j]=temp; } } template voi翻译 2014-10-31 16:19:54 · 678 阅读 · 0 评论