Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Checking between two id is same or not
- #include<bits/stdc++.h>
- using namespace std;
- void decimal(int &);
- int test(int[],int []);
- int main()
- {
- int t,a[4],b[4],i,chk;
- char c;
- cin>>t;
- for(i=0;i<t;i++)
- {
- cin>>a[0]>>c>>a[1]>>c>>a[2]>>c>>a[3];
- cin>>b[0]>>c>>b[1]>>c>>b[2]>>c>>b[3];
- for(int j =0;j<4;j++)
- decimal(b[j]);
- chk =test(a,b);
- if(chk==1)
- cout<<"Case "<<i+1<<": Yes"<<endl;
- else
- cout<<"Case "<<i+1<<": No"<<endl;
- }
- return 0;
- }
- void decimal(int &n)
- {
- int temp = n,i=0;
- int sum = 0;
- while(temp!=0)
- {
- sum = sum+((temp%10)*pow(2,i));
- i++;
- temp = temp/10;
- }
- n = sum;
- }
- int test(int a[],int b[])
- {
- if((a[0]==b[0])&&(a[1]==b[1])&&(a[2]==b[2])&&(a[3]==b[3]))
- return 1;
- else
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement