#include "stdafx.h"#include "math.h"#include "stdlib.h"#include "windows.h"#define PI 3.1415926//一.class LOCATION{protected:double x,y;public:virtual double getx()const{return x;} virtual double gety()const{return y;} virtual double dist(LOCATION s) const; LOCATION(){}; LOCATION(double x,double y):x(x),y(y){};};double LOCATION::dist(LOCATION s) const{ double xd=s.x-x, yd=s.y-y; return sqrt(xd*xd+yd*yd);}class CIRCLE : public LOCATION{ double r;public: double get_r() const {return r;} double Girth() const {return 2*PI*r;} double Area()const {return PI*r*r;} CIRCLE(); CIRCLE(double x,double y,double r) {this->x=x; this->y=y; this->r=r;}};//二.class Shape {public: virtual double Area() = 0;};class Trapezoid : public Shape{public: double x,y,h; Trapezoid(double x,double y,double h):x(x),y(y),h(h){}; double Area() {return (x+y)*h*0.5;}};class Circle : public Shape{public: double r; Circle(double r):r(r) {}; double Area() { return PI*r*r; }};class Triangle : public Shape{public: double x,y; Triangle(double x,double y):x(x),y(y){}; double Area() { return x*y; }};//三.template
class Stack{ T *x; int size; int current;public: Stack(int size) {this->size=size;current=0;x = new T[size]; } ~Stack(){ delete []x; } BOOL push(const T atom) {if(current
s(10); s.push(10); int test=0; s.pop(test); printf("%dn",test); system("pause"); return 0;}