C + + basic Student management System _c language

Source: Internet
Author: User
Tags strcmp

The example of this article for everyone to share the C + + basic Student management system implementation code, for your reference, the specific content as follows

Applicable to c++6.0,codeblocks and other common tools

1. Link List Processing part

#include <stdio.h> #include <string.h> #include <stdlib.h> #include "linklist.h" #include "elem.h" Voi
 D Dispnode (linklist h) {node *p;
 p=h->next;
  while (p) {Dispelem (P);
 p=p->next;
 {linklist h,t e) {node *p} int inputnode;
 Node *q;
 P=h;
  while (p->next&& (p->next->data). id<=e.id) {if (p->next->data). Id==e.id) return 0;
 p=p->next;
 } q= (node*) malloc (sizeof (node));
 q->data=e;
 q->next=p->next;
 p->next=q;
return 1;
 int Delnode (linklist h,int ID) {node *p;
 P=h;
 while (p->next&& (p->next->data). Id!=id) p=p->next;
  if (P->next) {node *t=p->next;
  p->next=t->next;
  Free (t);
 
 return 1;
 
else return 0;
 } node* searchname (linklist h,char name[]) {node *p;
 P=h-next;
 while (P && strcmp (p->data). Name, name)!=0) p=p->next;
return p;
 } node* Searchid (linklist h,int ID) {node *p;
 p=h->next; while (P->next &&
 (p->next->data). ID <= e.id) p=p->next;
return p;
 }

2. Data Processing Section     

#include <stdio.h> #include <string.h> #include <stdlib.h> #include "linklist.h" #include "elem.h" Voi
 D Dispnode (linklist h) {node *p;
 p=h->next;
  while (p) {Dispelem (P);
 p=p->next;
 {linklist h,t e) {node *p} int inputnode;
 Node *q;
 P=h;
  while (p->next&& (p->next->data). id<=e.id) {if (p->next->data). Id==e.id) return 0;
 p=p->next;
 } q= (node*) malloc (sizeof (node));
 q->data=e;
 q->next=p->next;
 p->next=q;
return 1;
 int Delnode (linklist h,int ID) {node *p;
 P=h;
 while (p->next&& (p->next->data). Id!=id) p=p->next;
  if (P->next) {node *t=p->next;
  p->next=t->next;
  Free (t);
 
 return 1;
 
 
 
 
else return 0;
 } node* searchname (linklist h,char name[]) {node *p;
 P=h-next;
 while (P && strcmp (p->data). Name, name)!=0) p=p->next;
return p;
 } node* Searchid (linklist h,int ID) {node *p;
 p=h->next; while (P->next && (p->next->data). ID <= e.id) p=p->next;
return p; }


3. File Processing Section     

#include <stdio.h> #include <string.h> #include <stdlib.h> #include "linklist.h" #include "elem.h" Voi
 D Dispnode (linklist h) {node *p;
 p=h->next;
  while (p) {Dispelem (P);
 p=p->next;
 {linklist h,t e) {node *p} int inputnode;
 Node *q;
 P=h;
  while (p->next&& (p->next->data). id<=e.id) {if (p->next->data). Id==e.id) return 0;
 p=p->next;
 } q= (node*) malloc (sizeof (node));
 q->data=e;
 q->next=p->next;
 p->next=q;
return 1;
 int Delnode (linklist h,int ID) {node *p;
 P=h;
 while (p->next&& (p->next->data). Id!=id) p=p->next;
  if (P->next) {node *t=p->next;
  p->next=t->next;
  Free (t);
 
 return 1;
 
 
 
 
else return 0;
 } node* searchname (linklist h,char name[]) {node *p;
 P=h-next;
 while (P && strcmp (p->data). Name, name)!=0) p=p->next;
return p;
 } node* Searchid (linklist h,int ID) {node *p;
 p=h->next; while (P->next && (p->next->data). ID <= e.id) p=p->next;
return p;
 }

4. Main Menu Customization Section

#include <stdio.h> #include <stdlib.h> #include "linklist.h" #include "elem.h" #include "fileop.h" void
 
MainMenu ();
 void Searchlinklist (Linlist h) {linklist h;
 H= (linklist) malloc (sizeof (node));
 h->next=null;
 LoadFile (h);
 MainMenu (h);
 SaveFile (h);
 printf ("\ n");
return 0;
 } void MainMenu () {node *p;
 int id;
 T e;
 int select;
 int count=1;
  Do {printf ("\ n"); printf ("----------------¡¶ssmgs os¡
  ---------------\ n ");
  printf ("1 displaying 2 searching 3 adding 4 deleting\n\n");
  printf ("5 changing 6 extiting \ n");
  printf ("--------------------welcome------------------------\ n");
  printf ("Please input your select:");
  scanf ("%d", &select);
   Switch (SELECT) {case 1:dispnode (h);
  Break
   Case 2:searchlinlist (h);
  Break
   Case 3:inputelem (&e);
   if (Inputnode (h,e)) printf ("succeed\n");
   else printf ("failed\n");
  Break
   Case 4:printf ("Please input ID:");
 
   scanf ("%d", &id);
Break  Case 5://function Reference break;
   Case 6://function references count=0;
  Break
 
}}while (count);
 }

5. header File Collection section

Elem.h part

 #ifndef linklist_h_included #define linklist_h_included #include "elem.h" typedef struct NOD
 e {T data;
struct node *next;
 
}node;
 
typedef node* Linklist;
 
void Dispnode (linklist h);
 
int Inputnode (linklist h,t e);
 
int Delnode (linklist h,int ID);
 
node* searchname (linklist H,char name[]);
 
 
 
 
 
 
node* Searchid (linklist h,int ID);
 
#endif//linklist_h_included fileop.h part #ifndef fileop_h_included #define fileop_h_included #include "linklist.h"
 
 
void SaveFile (linklist h);
 
 
 
void LoadFile (linklist h);
 
 
#endif//fileop_h_included linklist.h part #ifndef linklist_h_included #define linklist_h_included #include "elem.h"
 typedef struct Node {T data;
struct node *next;
 
}node;
 
typedef node* Linklist;
 
void Dispnode (linklist h);
 
int Inputnode (linklist h,t e);
 
int Delnode (linklist h,int ID);
 
node* searchname (linklist H,char name[]);
 
node* Searchid (linklist h,int ID); #endif//linklist_h_included 

The above is the entire content of this article, I hope to learn C + + language to help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.