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