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

📄 06_01.cpp

📁 一些C++的课件和实验源代码
💻 CPP
字号:
// 06_01.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include <iostream>
using namespace std;

class point{
	int x, y;
public:
	point(int x, int y){
		point::x = x;
		point::y = y;
		cout << "\n construct point: x = " << x << ", y = " << y << endl;
	}
	~point(){
		cout << "\n destroy point: x = " << x << ", y = " << y << endl;
	}

	friend void AddPoint1(point p1, point p2);
	friend void AddPoint2(point* p1, point* p2);
	friend void AddPoint3(point& p1, point& p2);
};

void AddPoint1(point p1, point p2){
	point pt(0, 0);
	pt.x = p1.x + p2.x;
	pt.y = p1.y + p2.y;
}

void AddPoint2(point *p1, point *p2){
	point pt(0, 0);
	pt.x = p1->x + p2->x;
	pt.y = p1->y + p2->y;
}

void AddPoint3(point& p1, point& p2){
	point pt(0, 0);
	pt.x = p1.x + p2.x;
	pt.y = p1.y + p2.y;
}

void f1(){
	point p1(10, 10), p2(20,20);
//	AddPoint1(p1, p2);
//	AddPoint2(&p1, &p2);
//	AddPoint3(p1, p2);
}

int main(int argc, char* argv[])
{
	f1();
	getch();
	return 0;
}

⌨️ 快捷键说明

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