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

📄 例6.3.txt

📁 铁道出版社出版的C++的习题源代码
💻 TXT
字号:
#include<iostream.h>
class M
{
public:
	M()
	{
		x=y=0;
	}
	M(int i,int j)
	{
		x=i;y=j;
	}
	void copy(M &m);
	void setxy(int i,int j)
	{
		x=i;
		y=j;
	}
	void print()
	{
		cout<<x<<","<<y<<endl;
	}
private:
	int x,y;
};
void M::copy(M &m)
{
	x=m.x;
	y=m.y;
}
void fun(M m1,M &m2);
void main()
{
	M p(5,7),q;
	q.copy(p);
	fun(p,q);
	p.print();
	q.print();
}
void fun(M m1,M &m2)
{
	m1.setxy(12,15);
	m2.setxy(22,25);
}

⌨️ 快捷键说明

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