/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press “Run” button to compile and execute it.
*******************************************************************************/
#include
using namespace std;
struct node{
int data;
struct nodenext;
};
struct nodehead=NULL,*newnode,temp;
int main(){
int choice=1;
while(choice)
{
newnode=(struct node)malloc(sizeof(struct node));
cin>>newnode->data;
newnode->next=0;
if(head==0)
{
newnode=head=temp;
}
else
{
newnode->next=head;
head=newnode;
}
cout<<“do you want to continue”;
cin>>choice;
}
temp=head;
while(temp!=0)
{
cout<data;
temp=temp->next;
}
}