Linked List-K Append(only one test case is passed)

#include
using namespace std;
class node{
public:
int data;
node* next;
node(int d){
data=d;
next=NULL;
}

};
void tail(node*&head,int d){

if(head==NULL){
    head=new node(d);
    return ;
}
node * temp=head;
while(temp->next!=NULL){
    temp=temp->next;
}
node* newnode=new node(d);
temp->next=newnode;
return;

}
void print(nodehead){
node
temp=head;
while(temp->next!=NULL){
cout<data<<" ";
temp=temp->next;
}
cout<data;
return;
}
void change(node*&head,int n,int k)
{
int m=n-k;
nodetemp=head;
node
temp2=head;
nodetemp3=head;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=temp2;
while(–m)
{
temp3=temp3->next;
}
head=temp3->next;
temp3->next=NULL;
return;
}
int main()
{
int n;
cin>>n;
node
head=NULL;
for(int i=1;i<=n;i++)
{
int m;
cin>>m;
tail(head,m);
}
int k;
cin>>k;
change(head,n,k);
print(head);
}

Hello @sachinyadav.111000,

Please, send your code using Online Coding Blocks IDE.
The way you have shared it, is introducing syntax error to it.

Waiting for your code.:slightly_smiling_face: