2.C++基础

1.求圆的周长例子:

#define CRT_SECURE_WARINGS
#include <iostream>
using namespace std;


class Circle
{
public:
    int m_R;
    int GetZhouchang()
    {
        return 2 * 3.14 * m_R;
    }

private:

};

void test()
{
    Circle c;
    c.m_R = 10;
    int z=c.GetZhouchang();
    cout << "周长为:" << z << endl;
}

int main()
{
    test();

    system("pause");

}

 

posted @ 2020-09-30 18:41  _MrZhu  阅读(74)  评论(0)    收藏  举报