11th Week Practice Project 1.1-point-circle-cylinder class family design

Source: Internet
Author: User

Questions and codes:

/* *copyright (c) 2016, *all right reserved, school of computer and Control engineering, Yantai University. * File name: 77.cpp *:    Dong Kai * Completion Date: May 6, 2016 * version number: v1.0 * * Problem Description: According to the following tips, starting from the design and testing of the base class, gradually complete the design of each class, to find out the surface area of the cylindrical cylinder, Volume and output and complete the required calculation tasks:  First establish a point (dot) class, including data members X, y (coordinate points), implement the required member functions, and design the main function to complete the test; * Input Description: * Program output: Point coordinates */#include < Iostream>using namespace Std;class point{public: Point    (Double x=0,double y=0);    void Putpoint (double,double);    Double GetX ()  {return x;}    Double GetY ()  {return y;}    void Show ();p rotected:    double x, y;}; Point::P oint (double a,double b)//implement constructor {    x=a;    Y=b;} void point::p utpoint (double a,double b) {    x=a;    Y=b;} void Point::show () {    cout<< "(" <<x<< "," <<y<< ")" <<ENDL;} int main () {point    P1;    Point P2 (3,4);    P1.show ();    P2.show ();    P1.putpoint (5,6);    P1.show ();    return 0;}
Operation Result:


Summary of Knowledge points:

This program summarizes the basic methods of building and implementing the previous class member functions.

Learning experience:

Able to solve such problems relatively skillfully.


11th Week Practice Project 1.1-point-circle-cylinder class family design

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.