#include<iostream>
using namespace std;
class BaraBitKaar{
public:
BaraBitKaar(){
}
void sub(int a, int b){
int sub=0;
sub=a-b;
cout<<" sum of the given binary number be:"<<sub<<endl;
}
};
int main(){
BaraBitKaar bar;
char c,d;
//first input
cout<<"please enter input 1"<<endl;
uint32_t a = 0;
while ((c=getchar()) != '\n') {
a <<= 1;
a += (c - '0') & 1;
}
printf("%u\n", a);
//second input
cout<<"please enter input 2"<<endl;
uint32_t e = 0;
while ((d=getchar()) != '\n') {
e <<= 1;
e += (d - '0') & 1;
}
printf("%u\n", e);
bar.sub(a,e);
return 0;
}
Comments
Leave a comment