exe4.cpp

来自「本压缩软件为《Visual C++6.0基础教程》(黑魔方系列)一书的源代码」· C++ 代码 · 共 27 行

CPP
27
字号
// Exe4.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream.h>
#include <string.h>
class  person
{  
	int age;
	char name[10];
public:
	void init(int i,char *str)
	{ 
		age=i;
		strcpy(name,str);
	}
	void display( )
	{	cout<<name<<" is "<<age<<" years old.\n"; }
};
void main( )
{
	person  demo;
	demo.init( 22,"Ji-hai-juan" );
	demo.display( );
}

⌨️ 快捷键说明

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