📄 ch19_16.cpp
字号:
//***********************
//** 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;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -