11th Week "Project 1-point-circle-cylinder Group Design 2"

Source: Internet
Author: User

/* *copyright (c) 2016, *all Rights reserved, School of computer and Control engineering, Yantai University. * File name: Main.cpp * Author: Chang Heng * Date of Completion: May 2, 2016 * version number: v1.0 * * Problem Description: a circle (Circle) class is derived from the point base, the data member R (RADIUS) is added, and the member function area of the space is calculated, Implement other required member functions, design the main function to complete the test; * Input Description: No * Output description: Output as required */#include <iostream> #include <cmath> #define PI 3.14using    Namespace Std;class point{public:point (double m,double n);    void Pointshow ();p rivate:double x; Double y;};    Point::P oint (double m,double n) {x=m; Y=n;}    void point::p ointshow () {cout<<) the center coordinates are: "<<endl; cout<<x<< "" <<y<<endl;}    Class Circle:public point{public:circle (double m,double n,int R2);    void area (); void Circleshow ();p rivate:int R;}; Circle::circle (double m,double n,int R2):P oint (m,n) {r=r2;}    void Circle::area () {double S;    S=pi*r*r; cout<< "The area of the circle is:" &LT;&LT;S&LT;&LT;ENDL;} void Circle::circleshow () {pointshow ();}    int main () {double x1,y1;    int R1;    cout<< "Please enter center coordinates:" <<endl; Cin>>x1>>y1;    cout<< "Please enter the radius of the circle:" <<endl;    cin>>r1;    Circle c (X1,Y1,R1);    C.circleshow (); C.area ();}

11th Week "Project 1-point-circle-cylinder Group Design 2"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.