Definition of sdut 2-1 Point class

Source: Internet
Author: User

Definition of sdut 2-1 Point class

2-1 Point class definition Time Limit: 1000 MS Memory limit: 65536 K Description

You can use this exercise to understand the definition of classes and objects;

Design a point class Time, which has private data members x (x coordinate), y (y coordinate); Public member function: SetPoint (int, int) is used to set the value of the point object, showPoint () is used to output the information of a vertex object.

In the main function, call the member function SetPoint (int, int) to set the value for the vertex object, and call the member function ShowPoint () to output the vertex information.

Input does not output a pair of parentheses, and the values of x and y are separated by commas (,).
None
Sample output
(10, 11)


# Include

 
  
Using namespace std; // declare class type class time {// define private part private: int x; int y; // define public part public: void setpoint () // assign the member function {x = 10; y = 11;} void showpoint () // output the member function {cout <"(" <

  

   

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.