VAISH2

You might also like

Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 2

FUNDAMENTAL DATA STRUCTURE

Name: Vaishnavi kiransingh pardeshi


class:SECOMP1
PRN:F22111016

#include<iostream>
using namespace std;

class student;
{
int roll;
string name;
student *next;
public;
student *create();
void display(student *head);
};
student* student: : create ()
{
int n;
student *head ,*p;
head=NULL;
cout<<"Enter number of student of club members:"<<endl;
cin>>n;
for(i=0,i<n,i++)
{
if(head==NULL)
{
head= new student;
cout<<"Enter prn of member: "<<endl;
cin>>head->roll;
cout<<"Enter name of member; "<<endl;
cin>>head->name;
head->next=NULL;
p=head;
}
else{
p->=new student;
p=p->next;
cout<<"Enter prn of member: "<<endl;
cin>>p->roll;
cout<<"Enter name of member: ";
cin>>p-name;
p->next=NULL;
}
}
return head;
};
void student: :display(student *head)
{
student *p;
for(p = head;p->next!=NULL;p = p->next)
{
cout<<p->roll<<" "<<p->name<<"->";
}
cout<<p->roll<<" "<<p->name;
}

int main()
{
student *head;
student obj;
head= obj.create();
obj.display(head);
return 0;
}

You might also like