ch19_16.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:
C#编程
开发平台:
Visual C++
- //***********************
- //** ch19_16.cpp **
- //***********************
- #include <iostream.h>
- #include <fstream.h>
- #include "student.h"
- #include "master.h"
- #include <string.h>
- void main()
- {
- ifstream fin("e:\bctemp\abc.txt");
- char sFirst[10];
- char sLast[10];
- unsigned int uid;
- float nGrade;
- char type;
- char name[20];
- Student* pS;
- int i=0;
- fin>>sLast >>sFirst >>uid >>nGrade >>type; while(!fin.eof()){
- strcpy(name,strcat(sLast," "));
- strcpy(name,strcat(name,sFirst));
- pS=new MasterStudent(name,uid,nGrade,type);
- cout <<"student #" <<++i <<":" <<*pS; delete pS;
- name[0]=0; //将name中内容置空串
- fin>>sLast >>sFirst >>uid >>nGrade >>type; }
- }