Solkar said:
What could be unclear about this
advice?
#include <iostream>
using namespace std;
int main() {
int m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15;
int arr[16]={m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15};
cout<<"Enter 1 or 0 in m0: "<< endl;
cin>>m0;
cout<<"Enter 1 or 0 in m1: "<< endl;
cin>>m1;
cout<<"Enter 1 or 0 in m2: "<< endl;
cin>>m2;
cout<<"Enter 1 or 0 in m3: "<< endl;
cin>>m3;
cout<<"Enter 1 or 0 in m4: "<< endl;
cin>>m4;
cout<<"Enter 1 or 0 in m5: "<< endl;
cin>>m5;
cout<<"Enter 1 or 0 in m6: "<< endl;
cin>>m6;
cout<<"Enter 1 or 0 in m7: "<< endl;
cin>>m7;
cout<<"Enter 1 or 0 in m8: "<< endl;
cin>>m8;
cout<<"Enter 1 or 0 in m9: "<< endl;
cin>>m9;
cout<<"Enter 1 or 0 in m10: "<< endl;
cin>>m10;
cout<<"Enter 1 or 0 in m11: "<< endl;
cin>>m11;
cout<<"Enter 1 or 0 in m12: "<< endl;
cin>>m12;
cout<<"Enter 1 or 0 in m13: "<< endl;
cin>>m13;
cout<<"Enter 1 or 0 in m14: "<< endl;
cin>>m14;
cout<<"Enter 1 or 0 in m15: "<< endl;
cin>>m15;
cout<<endl;
cout<<" C'D' "<<"C'D "<<"C D" <<" C D'" << endl;
cout<<"A'B'"<<" "<< m0<<" "<< m1<<" "<< m3<<" "<<m2<<endl;
cout<<"A'B"<<" "<< m4<<" "<< m5<<" "<< m7<<" "<< m6<<endl;
cout<<"A B"<<" "<<m12<<" "<< m13<<" "<< m15<<" "<< m14<<endl;
cout<<"A B'"<<" "<<m8<<" "<< m9<<" "<< m11<<" "<< m10<<endl;
if((m0==1)&&(m1==1)&&(m2==1)&&(m3==1)&&(m4==1)&(m5==1)&&(m6==1)&&(m7==1)&&(m8==1)&&(m9==1)&&(m10==1)&&(m11==1)&&(m12==1)&&(m13==1)&&(m14==1)&&(m15==1))
cout<<endl<<"Simplified Function is F: "<<1 <<endl;
else if((m0==0)&&(m1==0)&&(m2==1)&&(m3==0)&&(m4==0)&(m5==0)&&(m6==0)&&(m7==0)&&(m8==0)&&(m9==0)&&(m10==0)&&(m11==0)&&(m12==0)&&(m13==0)&&(m14==0)&&(m15==0))
cout<<"Simplified Function is F: "<<"A'B'C D'" <<endl;
else if((m0==0)&&(m1==0)&&(m2==1)&&(m3==1)&&(m4==0)&(m5==0)&&(m6==0)&&(m7==0)&&(m8==0)&&(m9==0)&&(m10==0)&&(m11==0)&&(m12==0)&&(m13==0)&&(m14==0)&&(m15==0))
cout<<"Simplified Function is F: "<<"A'B'C" <<endl;
else if((m0==0)&&(m1==1)&&(m2==1)&&(m3==1)&&(m4==0)&(m5==0)&&(m6==0)&&(m7==0)&&(m8==0)&&(m9==0)&&(m10==0)&&(m11==0)&&(m12==0)&&(m13==0)&&(m14==0)&&(m15==0))
cout<<"Simplified Function is F: "<<"A'B'D+A'B'C" <<endl;
else
cout<<"Simplified Function is F: "<<"0" <<endl;
return 0;
}
I made something like this but the possible combinations are around 64k is there a way to make a loop which makes it easier to check all the combinations of 1 and 0? also is the technique right to implement K-maps?
Suppose I want the user to input the 1 and 0s in one line how can I do that? by storing the values in a string array?