main()函数里面:
Banji stuifo
(100);
return 0;
banji.cpp里面:#include "banji.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
中间
}
break;
}
case 3:
break;
}
student .cpp
#include "student.h"
#include <iostream>
#include <string>
using namespace std;
void Student::SetStudentName(string str)
{
if(str[0]=='\0')
{
string str1;
str1 = new char[20]; // 析构函数里面要删除内存。
cout<<"输入姓名:";
cin >> str1;
this->name=str1;
}
else
this->name=str;
}