zoukankan      html  css  js  c++  java
  • 百思不得己

    #include<iostream>
    #include<iomanip>
    using namespace std;
    class Point
    {
    private :
            double x, y;
            static int  m , n;
    public :
        Point(double a=0)
        {
            x=a;y=a;
            m++;n++;
        }
        Point(double a,double b)
        {
            x=a; y=b;
            m++;n++;
        }
        Point(const Point&p)
        {
            x=p.x; y=p.y;
            m++;n++;
        }
        ~Point()
        {
            m--;
        }
        int show()
        {
            std::cout<<"Point : ("<<setprecision(16)<<x<<", "<<setprecision(16)<< y<<")"<<std::endl;
        }
        static void showCounter(){cout<<"Current : "<<m<<" points."<<endl;}
        static void showSumOfPoint(){cout<<"In total : "<<n<<" points."<<endl;}
    
    };
    int Point::   m=0;
    int Point::   n=0;
    void showPoint(Point &p){p.show();}
    void showPoint(Point &q,Point &w,Point &e){q.show();w.show();e.show();}
    
    
    int main()
    {
        char c;
        double a, b;
        Point q;
        while(std::cin>>a>>c>>b)
        {
            Point p(a, b);
            p.show();
            p.showCounter();
        }
        q.showSumOfPoint();
        Point q1(q), q2(1);
        Point::showCounter();
        showPoint(q1, q2, q);
        Point::showSumOfPoint();
    }
    

      

    作者:7oDo

    仅供参考,请勿抄袭。

    Hang Hang Hang !!!

  • 相关阅读:
    vue-实践1
    node 基本使用
    vue通信
    初始AMD和Common.js
    vue正确引入第三方包
    常见的java设计模式
    springboot加ES实现全局检索
    Cookie丢失的原因
    动态SQL
    用Java实现给图片添加文字
  • 原文地址:https://www.cnblogs.com/Jie-Fei/p/8575084.html
Copyright © 2011-2022 走看看