#include<bits/stdc++.h>
using namespace std;
struct Node{
int val1,val2;
Node*next;
};
Node*InsertAtEnd(Node*root,int x1,int x2)
{
Node*newnode=new Node();
newnode->next=NULL;
newnode->val1=x1;
newnode->val2=x2;
if(root==NULL)
{
root=newnode;
return root;
}
Node*currnode;
currnode=root;
while(currnode->next!=NULL)
{
currnode=currnode->next;
}
currnode->next=newnode;
return root;
}
void Print(Node*root)
{
Node*currnode;
currnode=root;
while(currnode!=NULL)
{
cout<<"x1:"<<currnode->val1<<"x2:"<<currnode->val2<<endl;
currnode=currnode->next;
}
cout<<endl;
}
int main()
{
Node*root=NULL;
root=InsertAtEnd(root,3,5);
root=InsertAtEnd(root,7,5);
Print(root);
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKc3RydWN0IE5vZGV7CmludCB2YWwxLHZhbDI7Ck5vZGUqbmV4dDsKfTsKTm9kZSpJbnNlcnRBdEVuZChOb2RlKnJvb3QsaW50IHgxLGludCB4MikKewpOb2RlKm5ld25vZGU9bmV3IE5vZGUoKTsKbmV3bm9kZS0+bmV4dD1OVUxMOwpuZXdub2RlLT52YWwxPXgxOwpuZXdub2RlLT52YWwyPXgyOwppZihyb290PT1OVUxMKQp7CnJvb3Q9bmV3bm9kZTsKcmV0dXJuIHJvb3Q7Cn0KTm9kZSpjdXJybm9kZTsKY3Vycm5vZGU9cm9vdDsKd2hpbGUoY3Vycm5vZGUtPm5leHQhPU5VTEwpCnsKY3Vycm5vZGU9Y3Vycm5vZGUtPm5leHQ7Cn0KY3Vycm5vZGUtPm5leHQ9bmV3bm9kZTsKcmV0dXJuIHJvb3Q7Cn0Kdm9pZCBQcmludChOb2RlKnJvb3QpCnsKTm9kZSpjdXJybm9kZTsKY3Vycm5vZGU9cm9vdDsKd2hpbGUoY3Vycm5vZGUhPU5VTEwpCnsKY291dDw8IngxOiI8PGN1cnJub2RlLT52YWwxPDwieDI6Ijw8Y3Vycm5vZGUtPnZhbDI8PGVuZGw7CmN1cnJub2RlPWN1cnJub2RlLT5uZXh0Owp9CmNvdXQ8PGVuZGw7Cn0KaW50IG1haW4oKQp7Ck5vZGUqcm9vdD1OVUxMOwpyb290PUluc2VydEF0RW5kKHJvb3QsMyw1KTsKcm9vdD1JbnNlcnRBdEVuZChyb290LDcsNSk7CgpQcmludChyb290KTsKfQo=