You are on page 1of 1

int main() { struct stud { int age; int roll; char name[30]; stud *next; }; int main() { stud

*start,*current,*previous; char k; start=new stud; current=start; previous=start; for(;;) { cout<<"Enter name:"; cin.getline(current->name,30); cout<<"Enter age"; cin>>current->age; cout<<"Enter roll:"; cin>>current->roll; cout<<"Any thing more(y/n):"; cin>>k; current->next=NULL; if(k==n) break; current=new item; previous->next=current; previous=current; } for(start) { cout<<start->name<<" "<<start->age<<" "<<start->roll; } } return 0; }

You might also like