cpp2.cpp

来自「学习VC++的最基础程序」· C++ 代码 · 共 23 行

CPP
23
字号
#include<iostream>
using namespace std;
//--------------------
class Animal{
	int itsWeight;
	int itsAge;
public:
	void set(int x,int y){itsWeight=x;itsAge=y;}
	void print(){cout<<itsWeight<<" "<<itsAge<<endl;}
};
//--------------------
void setValue(Animal& ta,int tw,int tn)
{
	ta.set(tw,tn);
}
//--------------------
int main(){
	Animal peppy;
	setValue(peppy,7,9);
	peppy.print();
	return 1;
}

⌨️ 快捷键说明

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