1、大连海事大学 C 语言与 Windows程序 设计 6道 课后题答案 1.( 1) 设计具有以下功能的程序:从键盘上输入 10 个非负整数,统计并输出最大数和最小数,当输入负数时结束输入。 #include void main() int a, max=-1, min=32767,num=1; couta; if(amax) max =a; if(a=0 float sum=0.0; printf(“请输入 n: “); scanf(“%d“, for(i=1;i class Point private: int X; int Y; public: Point(int X, int Y) th
2、is-X = X; this-Y = Y; Point() this-X = 0; this-Y = 0; Point() int GetX() return this-X; int GetY() return this-Y; void SetX(int X) this-X = X; void SetY(int Y) this-Y = Y; void MoveTo(int X, int Y) SetX(X); SetY(Y); void Display() cout class Point private: int X; int Y; public: Point(int X, int Y) t
3、his-X = X; this-Y = Y; Point() this-X = 0; this-Y = 0; Point() int GetX() return this-X; int GetY() return this-Y; void SetX(int X) this-X = X; void SetY(int Y) this-Y = Y; void MoveTo(int X, int Y) SetX(X); SetY(Y); /* void Display() coutR = R; Circle() Point GetO() return this-O; int GetR() return this-R; void MoveTo(Point void SetR(int R) this-R = R; void Display() cout class Date public: Date() Date(int y, int m, int d) SetDate(y, m, d); void SetDate(int y, int m, int d) Year = y; Month = m; Day = d; void GetDate() coutcalarea()endl;