?? liststudent.cpp
字號:
#include <iostream>
#include "liststudent.h"
bool Liststudent::insert(const Student & stu)
{
first->next = new Linkstudent(stu, first->next);
if(tail == first)
tail = first->next;
size++;
return true;
}
bool Liststudent::append(const Student &stu)
{
tail->next = new Linkstudent(stu,NULL);
tail = tail->next;
tail->next = NULL;
size++;
return true;
}
void Liststudent::show_all()const
{
cout << "name\tsnumber\tage\tsex\tyuwen\tmath\tenglish\ttotal\taverage"<<endl;
Linkstudent *temp = first->next;
while(temp != NULL)
{
temp->stu.showall();
temp = temp->next;
}
}
bool Liststudent::remove_n(char *n)
{
if(empty()) return false;
Linkstudent *temp = first;
Linkstudent *dele;
while(temp->next != NULL)
{
if(!strcmp(n , temp->next->stu.get_n() ))
{
dele = temp->next;
temp->next = dele->next;
delete dele;
size--;
return true;
}
temp = temp->next;
}
return false;
}
bool Liststudent::remvoe_sn(char *sn)
{
Linkstudent *temp = first;
Linkstudent *dele;
while(temp->next != NULL)
{
if(!strcmp(sn , temp->next->stu.get_sn() ))
{
dele = temp->next;
temp->next = dele->next;
delete dele;
size--;
return true;
}
temp = temp->next;
}
return false;
}
Linkstudent * Liststudent::find_n(char *n)
{
if(empty())
return NULL;
Linkstudent *temp = first->next;
while(temp != NULL)
{
if(!strcmp(n , temp->stu.get_n() ))
return temp;
temp = temp->next;
}
return NULL;
}
Linkstudent * Liststudent::find_sn(char *sn)
{
if(empty())
return NULL;
Linkstudent *temp = first->next;
while(temp != NULL)
{
if(!strcmp(sn , temp->stu.get_sn() ))
return temp;
temp = temp->next;
}
return NULL;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -