#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<<"→";
currnode=currnode->next;
}
cout<<endl;
}
int main()
{
Node*root=NULL;
root=InsertAtEnd(root,3,5);
root=InsertAtEnd(root,7,5);
Print(root);
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKc3RydWN0IE5vZGV7CmludCB2YWwxLHZhbDI7Ck5vZGUqbmV4dDsKfTsKTm9kZSpJbnNlcnRBdEVuZChOb2RlKnJvb3QsaW50IHgxLGludCB4MikKewpOb2RlKm5ld25vZGU9bmV3IE5vZGUoKTsKbmV3bm9kZS0+bmV4dD1OVUxMOwpuZXdub2RlLT52YWwxPXgxOwpuZXdub2RlLT52YWwyPXgyOwppZihyb290PT1OVUxMKQp7CnJvb3Q9bmV3bm9kZTsKcmV0dXJuIHJvb3Q7Cn0KTm9kZSpjdXJybm9kZTsKY3Vycm5vZGU9cm9vdDsKd2hpbGUoY3Vycm5vZGUtPm5leHQhPU5VTEwpCnsKY3Vycm5vZGU9Y3Vycm5vZGUtPm5leHQ7Cn0KY3Vycm5vZGUtPm5leHQ9bmV3bm9kZTsKcmV0dXJuIHJvb3Q7Cn0Kdm9pZCBQcmludChOb2RlKnJvb3QpCnsKTm9kZSpjdXJybm9kZTsKY3Vycm5vZGU9cm9vdDsKd2hpbGUoY3Vycm5vZGUhPU5VTEwpCnsKY291dDw8IngxOiI8PGN1cnJub2RlLT52YWwxPDwi4oaSIjw8IngyOiI8PGN1cnJub2RlLT52YWwyPDwi4oaSIjsKY3Vycm5vZGU9Y3Vycm5vZGUtPm5leHQ7Cn0KY291dDw8ZW5kbDsKfQppbnQgbWFpbigpCnsKTm9kZSpyb290PU5VTEw7CnJvb3Q9SW5zZXJ0QXRFbmQocm9vdCwzLDUpOwpyb290PUluc2VydEF0RW5kKHJvb3QsNyw1KTsKClByaW50KHJvb3QpOwp9Cg==