#include <iostream> #include <string> #include <stdio.h> #include <string.h> using namespace std; class gammal{ private: -string name; -int payment; public: -gammal *next; -gammal(){ --cout<<"New member created"<<endl; -} -void get_data(){ --cout<<"Enter name: "; --cin>>name; --cout<<"Enter payment: "; --cin>>payment; --next = NULL; -} -void print(){ --cout<<"---------"<<endl; --cout<<name<<endl<<payment<<endl; -} -~gammal(){ --cout<<"Member Deleted"<<endl; -} }; gammal* add (gammal *g){ -if(g == NULL){ --g = new gammal; --g->get_data(); --return g; -} -g->next = add(g->next); -return g; } void show (gammal *g){ -while(g != NULL){ --g->print(); --g = g->next; -} -cout<<"------"<<endl; } int main() { -int a; -gammal *head=NULL; -do{ --printf( "1) Add " ----"2) Show " ----"Please, enter a number: "); --scanf("%d",&a); --if(a==1) ---head = add(head); --else if(a==2) ---show(head); -}while( a ); }