21_3.cpp
来自「这是一些c++例程」· C++ 代码 · 共 40 行
CPP
40 行
// 21_3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream.h"
//TPoit类的定义
class TPoint
{
public:
TPoint(int x, int y)
{
nX=x;
nY=y;
};
int nX, nY;
int XCoord(){return nX;};
int YCoord(){return nY;};
};
TPoint f(TPoint Q);
void main()
{
TPoint M(20, 35),P(0, 0);
TPoint N(M);
P = f(N);
cout<<"P = "<<P.XCoord()<<", "<<P.YCoord()<<endl;
}
TPoint f(TPoint Q)
{
int x, y;
x = Q.XCoord()+10;
y = Q.YCoord()+20;
TPoint R(x, y);
return R;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?