Question: C++ Program. No Global Variables. Should use functions OR, AND and XOR Calculate the boolean algebraic results for OR, AND and XOR of the two
C++ Program. No Global Variables. Should use functions
OR, AND and XOR
Calculate the boolean algebraic results for OR, AND and XOR of the two input arrays
Performed on an element by element basis. An element of the first array is combined (using OR, AND or XOR boolean algebra) with the same element of the second array
OR if at least one of the two elements has a value of 1, the OR result is 1 otherwise it is a 0 (both elements are 0)
AND if the elements of both arrays have a value of 1, the AND result is 1 otherwise it is a 0
XOR if the value of one element is a 1 and the value of the other element is a 0, the XOR result is 1 otherwise it is a 0
Then convert from binary to decimal
Output of input array values
Print a heading similar to the one in the sample solution
Print out headings for the array left justified in a field width of 2*numCols
Print the two arrays side-by-side separated by 4 spaces -
Array elements are printed with a single space between them.
Input Files: 1.
10 // number of rows
10 // number of columns
0 0 1 1 0 1 1 1 1 1
1 1 0 0 1 0 0 0 0 0
0 1 1 0 0 1 1 1 1 1
1 0 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 1 1 0
0 0 0 0 0 1 1 0 0 1
1 1 1 1 1 0 1 1 0 0
0 0 0 0 0 1 0 0 1 1
1 1 1 1 1 1 1 0 0 0
1 1 1 1 1 0 0 1 1 0
0 0 0 0 0 1 1 0 0 1
1 1 1 1 1 0 1 1 0 0
0 0 0 0 0 1 0 0 1 1
1 1 1 1 1 1 1 0 0 0
0 0 1 1 0 1 1 1 1 1
1 1 0 0 1 0 0 0 0 0
0 1 1 0 0 1 1 1 1 1
1 0 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1 1
2.
5 // number of rows
5 // number of columns
0 0 1 1 0
1 1 0 0 1
0 1 1 0 0
1 0 0 1 1
1 1 0 0 0
1 1 1 1 1
0 0 0 0 0
1 1 1 1 1
0 0 0 0 0
1 1 1 1 1
OutPut Should look similar to this:

Enter the name of the input file: P9_inl.txt P9 inl.txt Initial values of the arrays processed Array 1 Array 2 OR, AND and XOR results OR AND XOR Integer Equivalents for the rows of the OR, AND and XOR arrays OR AND 198 396 792 XOR 1023 825 1023 627 1023 1023 825 1023 627 1023 825 825 627 627 231 825 825 627 627 231 198 396 792
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
