What am i doing wrong ....and how to take user input without while(data!=-1)
in this question input format is different so you can’t use whie(data!=-1)
here you have given no of elements
for make a for loop
void buildList(node*&head){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>data;
insertAtTail(head,data);
}
}
i figured out the input .thanks please suggest the further mistakes in the code
i have done some changes you can see
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course