⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 point.cpp

📁 hello everybody. good lucky to you
💻 CPP
字号:
// Borland C++ - (C) Copyright 1991 by Borland International

// POINT.CPP - Example from Getting Started
//             Illustrates a simple Point class 

#include <iostream.h>	// needed for C++ I/O

class Point {		// define Point class
   int X;               // X and Y are private by default
   int Y;
public:
   Point(int InitX, int InitY) {X = InitX; Y = InitY;}
   int GetX() {return X;}  // public member functions
   int GetY() {return Y;}
};

int main()
{
   int YourX, YourY;

   cout << "Set X coordinate: ";  // screen prompt
   cin >> YourX;                  // keyboard input to YourX

   cout << "Set Y coordinate: ";  // another prompt
   cin >> YourY;                  // key value for YourY

   Point YourPoint(YourX, YourY);  // declaration calls constructor

   cout << "X is " << YourPoint.GetX(); // call member function
   cout << '\n';                        // newline
   cout << "Y is " << YourPoint.GetY(); // call member function
   cout << '\n';
   return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -