STUDENT.H
资源名称:C++100.rar [点击查看]
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- //File STUDENT.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;
- printf("nYou are in the constructor(gouzao function)!");
- printf("nInitial the data to nulln");
- printf("nPress any key to continue... ...");
- getch();
- }
- 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);
- }
- };