What is wrong with the code?

#include
using namespace std;
struct Node{
int data;
Node * next;
Node(int x):data(x),next(NULL){}
};
int main() {
int t,x;
cin>>t;
Node* head=NULL,*oddh=NULL,*evenh=NULL,*temp,*temp1;
if(t>0)
{
cin>>x;
head=new Node(x);
temp=head;
}
for(int i=1;i<=t-1;i++)
{
cin>>x;
temp=new Node(x);
temp=temp->next;
}
temp=head;
while(temp!=NULL)
{
x=temp->data;
if(x%2){
oddh=temp;
break;
}
temp=temp->next;
}
temp=head;
while(temp!=NULL)
{
x=temp->data;
if(x%2==0){
evenh=temp;
break;
}
temp=temp->next;
}
if(oddh!=NULL){
temp=oddh->next;
temp1=oddh;
while(temp!=NULL)
{
x=temp->data;
if(x%2)
{
temp1->next=temp;
temp1=temp1->next;
}
temp=temp->next;
}
}
temp=evenh->next;
temp1=evenh;
while(temp!=NULL)
{
x=temp->data;
if(x%2==0)
{
temp1->next=temp;
temp1=temp1->next;
}
temp=temp->next;
}

temp=oddh;
while(temp->next!=NULL)
temp=temp->next;

temp->next=evenh;

temp=oddh;
while(temp!=NULL)
{
	cout<<temp->data<<" ";
	temp=temp->next;
}
cout<<endl;

return 0;

}

Please provide your code in coding blocks IDE.

Done! I switched on the other mode

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.