zoukankan      html  css  js  c++  java
  • 自考新教材-p148_4

    源程序:

    #include <iostream>
    using namespace std;
    class Location
    {
    public:
    int x, y;
    void init(int initx,int inity);
    int Getx();
    int Gety();
    };
    void Location::init(int initx, int inity)
    {
    x = initx;
    y = inity;
    }
    int Location::Getx()
    {
    return x;
    }
    int Location::Gety()
    {
    return y;
    }
    void display(Location &rL)
    {
    cout << rL.Getx() << " " << rL.Gety() << endl;
    }
    int main()
    {
    Location A[5] = { {5,5},{3,3},{1,1},{2,2},{4,4} };
    Location *rA = A;
    A[3].init(7,3);
    rA->init(7,8);
    for (int k = 0; k < 5; k++)
    display(*(rA++));
    system("pause");
    return 1;
    }

    运行结果:

  • 相关阅读:
    Promise
    replace
    mongogogog
    sh back mongo
    mongodb 备份 还原 导出 导入
    mongo virtual
    openssl
    isMobile
    google api autocomplete
    npm
  • 原文地址:https://www.cnblogs.com/duanqibo/p/12270201.html
Copyright © 2011-2022 走看看