#include #include using namespace std; int size=0; class Student{ public: string name; int marks; Student *nextStudent; void setName(string setn){ name=setn; } string getName(){ return name; } void setMarks(int setm){ marks=setm; } int getMarks(){ return marks; } void setNextStudent(Student *setAddress){ nextStudent=setAddress; } Student* getNextStudent(){ return nextStudent; } }; class Stack{ public: Student *headStudent=NULL; bool isEmpty(){ if(headStudent==NULL){ cout<>n; newNode->setName(n); cout<<"Enter the Marks of Student: "; cin>>m; newNode->setMarks(m); newNode->setNextStudent(NULL); if(headStudent==NULL){ headStudent=newNode; } else{ Student *ptr=headStudent; while ( ptr-> getNextStudent()!=NULL ) { ptr=ptr->getNextStudent(); } ptr->setNextStudent(newNode); } cout<getNextStudent()!=NULL) { pre=ptr; ptr=ptr->getNextStudent(); } if(ptr==headStudent){ headStudent==NULL; } else{ pre->setNextStudent(NULL); } delete ptr; size--; cout<getName(); m[j++]=ptr->getMarks(); ptr=ptr->getNextStudent(); } for(int k=size-1;k>=0;k--){ cout<getMarks()getNextStudent()->getMarks()){ } ptr=ptr->getNextStudent(); } } } void top(){ if(!isEmpty()) { cout<getName()<<"\t\t"<getMarks(); ptr=ptr->getNextStudent(); } cout<>choice; switch(choice) { case 1: s.push(); break; case 2: s.pop(); break; case 3: s.display(); break; case 4: s.top(); break; default : exit(0); break; } } return 0; }