[데이터 구조 상의 작업] 일부 학생 들 의 성적 (적어도 학생 번호, 성명, 과정 성적 포함) 을 입력 하고 단일 체인 표 로 저장 하 며 평균 성적 보다 큰 학생 정 보 를 출력 합 니 다.

2306 단어
한 무리의 학생 들 의 성적 (적어도 학생 번호, 성명, 과정 성적 포함) 을 입력 하고 단일 체인 표 로 저장 하 며 평균 성적 보다 큰 학생 정 보 를 출력 한다.구현 코드
#include 
#include
#include
#include
#include 

using namespace std;
struct link *AddNode(struct link *head);
void ShowNode(struct link*head);
void DeleteMemory(struct link *head);
void ShowYouSheng(struct link *head);
struct link *DeleteNode(struct link *head, char NodeDate[100]);
struct link *InsertNode(struct link *head);
struct link
{
    int grade;
    char name[100];
    char stunum[100];
    struct link *next;
};
int main()
{
    char c;
    int i = 0;
    struct link *head = NULL;
    cout<c;
    while(c == 'Y')
    {
        head = AddNode(head);
        //ShowNode(head);
        cout<c;
        i ++;
    }
    cout<  1,  ->2,    ->3;  ->0"<>b;
      if(b == 3)
      {
          ;
      }
      else if(b == 2)
      {
          cout<Deletestunum;
          DeleteNode(head,Deletestunum);
          cout<next;
        }
        pr->next = p;
    }
    cout<name >>stunum >>grade;
    p->name = name;
    p->stunum = stunum;
    p->grade = grade;*/
    cin>>p->name;
    cin>>p->stunum;
    cin>>p->grade;
    p->next = NULL;
    return head;
}
void ShowNode(struct link *head)
{
    struct link *p = head;
    int j = 1;
    while (p != NULL)
    {
        coutnext;
        free(pr);
    }
}
void ShowYouSheng(struct link *head)
{
    struct link *p = head,*p2 = head;
    int sum=0,o=0;
    double averagesum;
    while(p != NULL)
    {
        sum=sum+(p->grade);
        o ++;
        p = p->next;
        //cout averagesum)
        {
            cout<next != NULL)
    {
        pr = p;
        p = p->next;
    }
    if(strcmp(NodeDate,p->stunum) == 0)
    {
        if(p == head)
        {
            head = p->next;
        }
        else
        {
            pr->next = p->next;
        }
        free(p);
    }
    else
    {
        cout<next;
        }
        pr->next = p;
 }
    cout<p->name;
     cin>>p->stunum;
     cin>>p->grade;
     p->next = NULL;

return head;
}

좋은 웹페이지 즐겨찾기