class StudentInformation
{
public:
StudentInformation* next;
void k();
void InPut(StudentInformation* p);
void input();
void find();
void show();
void edit();
void statistics();
void save();
void read();
void showformat();
void showthing(StudentInformation* m);
private:
int studentNumber;
std::string studentName;
int studentSex;
char absentDate[11];
int absentclassNumber;
std::string className;
int absentType;
};
StudentInformation* first = NULL;
void StudentInformation::InPut(StudentInformation* p)
{
p->next = first;
first = p;
}
void StudentInformation::input()
{
int times;
cout << "Please input the amount you want:";
cin >> times;
for (int k = 0; k {
if (k > 0)
{
cout << endl;
cout << endl;
cout << "Next student's information" << endl;
cout << endl;
}
StudentInformation *new_information = new StudentInformation;
cout << "Please input the student number:";
cin >> new_information->studentNumber;
cout << "Please input the studentname:";
cin >> new_information->studentName;
cout << "Please input the studentSex(0 is female, 1 is man):";
cin >> new_information->studentSex;
cout << "Please input the absentDate:";
cin >> new_information->absentDate;
cout << "Please input the absentclassNumber:";
cin >> new_information->absentclassNumber;
cout << "Please input the className:";
cin >> new_information->className;
cout << "Please input the absentType(1.Be late 2.Leave early 3.Ask for leave 4.Absent):";
cin >> new_information->absentType;
StudentInformation::InPut(new_information);
delete new_information;
}
}
代码不完整
for (int k = 0; k {
这里丢失了字符
main函数没有
也没看到你把new_information挂在链表上的操作
而且你竟然delete new_information;