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

📄 destruct.h

📁 C++时尚编程百例 很不错的C++实例 绝对经典
💻 H
字号:
//File DESTRUCTOR.H

#include  <stdio.h>
#include  <conio.h>
#include <string.h>

class STUDENT
{
	private :
			char *NAME;
			char *AGE;
			char *ID;
			char *TEL_NUM;
			char *ADDRESS;
	public :
			STUDENT()                      //Automatic Initial
			{
				NAME=NULL;
				AGE=NULL;
				ID=NULL;
				TEL_NUM=NULL;
				ADDRESS=NULL;
			}
			void AddName(char *ST)
			{
				NAME=new char[strlen(ST)+1];
				strcpy(NAME,ST);
			}
			void AddAge(char *ST)
			{
				AGE=new char[strlen(ST)+1];
				strcpy(AGE,ST);
			}
			void AddId(char *ST)
			{
				ID=new char[strlen(ST)+1];
				strcpy(ID,ST);
			}
			void AddTel(char *ST)
			{
				TEL_NUM=new char[strlen(ST)+1];
				strcpy(TEL_NUM,ST);
			}
			void AddAddress(char *ST)
			{
				ADDRESS=new char[strlen(ST)+1];
				strcpy(ADDRESS,ST);
			}
			void Print()
			{
				printf("\n%s   %s    %s",NAME,AGE,ID);
				printf("\n%s",TEL_NUM);
				printf("\n%s",ADDRESS);
			}
			~STUDENT()
			{
				printf("\n\nYou are in the destructor(xigou funtion)!");
				printf("\n\nYou can ALSO just put nothing in this position,"
					"it is just an example!");
				printf("Press any key to exit... ...");
				getch();
			}
};

⌨️ 快捷键说明

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