Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<conio.h>
- #include<iostream>
- #include<fstream>
- #include<Windows.h>
- #include<dos.h>
- #include<cctype>
- #include<sstream>
- #include<string>
- using namespace std;
- bool check = true;
- struct node
- {
- string name;
- int grade;
- node *next;
- }*head,*lastptr;
- void display(struct node* head, char Cchoice,int Igrade)
- {
- struct node *temp = head;
- cout <<"\n\nList elements are - \n";
- while(temp != NULL)
- {
- switch(toupper(Cchoice))
- {
- case 'A':
- if (temp->grade==Igrade)
- {
- cout << "Name: " << temp->name<<endl;
- cout << "Grade: " << temp->grade<<endl;
- } break;
- case 'B':
- if (temp->grade>Igrade)
- {
- cout << "Name: " << temp->name<<endl;
- cout << "Grade: " << temp->grade<<endl;
- }break;
- case 'C':
- if (temp->grade<Igrade)
- {
- cout << "Name: " << temp->name<<endl;
- cout << "Grade: " << temp->grade<<endl;
- }break;
- default:
- cout << "Name: " << temp->name<<endl;
- cout << "Grade: " << temp->grade<<endl;
- }
- temp = temp->next;
- }
- }
- void add()
- {
- node *p;
- p=new node;
- cout<<"Enter name of student: "<<endl;
- cin>> p->name;
- cout<<"Enter Grade: "<<endl;
- cin>>p->grade;
- p->next=NULL;
- if(check)
- {
- head = p;
- lastptr = p;
- check = false;
- }
- else
- {
- lastptr->next=p;
- lastptr=p;
- }
- cout<<endl<<"Recorded"<<endl;
- getch();
- }
- int main()
- {
- char x;
- cout<<"\t\t ******************************* \t\t\t"<<endl;
- cout<<"\t\t ***STUDENT MANAGEMENT SYSTEM*** \t\t\t"<<endl;
- cout<<"\t\t ******************************* \t\t\t"<<endl<<endl;
- getch();
- char choice = 'X', Cchoice = 'X', Nchoice = 'X';
- int i=0, Igrade=0;
- while (toupper(choice)!='N')
- {
- add(); i++;
- cout<<"More Entry [Y] / [N]: "; cin>>choice;
- }
- while (toupper(Nchoice)!='N')
- {
- cout << "Criteria for displaying the list: "<<endl;
- cout << "A. Grade =\nB. Grade >\nC. Grade < \n D. All\n";
- cout << "Enter Choice (A-D): "; cin>>Cchoice;
- if(toupper(Cchoice)!='D')
- {
- cout << "Grade: ";cin>>Igrade;
- }
- display(head, Cchoice, Igrade);
- cout<<"More Entry [Y] / [N]: "; cin>>Nchoice;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement