Please help me in Binary XOR operation.... This program will ask user to enter their input..After that the program will convert to Binary Code for each character that user have entered. After that i create a multidimensional array to store for binary of each character...so from an array, i want to make a XOR operation for each binary..

Example :-
User Input : syahril
Binary for each character is :-
s = 01110011
y = 01111001
a = 01100001
h = 01101000
r = 01110010
i = 01101001
l = 01101100

So, my array will be like this

0 0 0 0 0 0 0
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 0 0 1 0 0
0 1 0 1 0 1 1
0 0 0 0 0 0 1
1 0 0 0 1 0 0

** the top row is the left most side for each character
** the bottom row is the right most side for each character

so...my program will do XOR operation for each binary in array start with top row from left to right...
so...when i executed and run my program it give to me an output like this = 00000000
but when i do a manual calculation for XOR operation based on the example, i will get an output like this = 01110100...

``````#include <string.h>
#include <stdlib.h>
#include <iostream.h>

char *Entry, Letter, Choice;
int Ascii, len, Binary, Total;
void Convert();
int f = 0;
int Special;
int temp;
int hold;
int k =0;
int s=2;
int z=1;
int h=2;
int m=1;
int x=0;
int u=0;
int y = 0;
int result;
int la = 0;
int temp_len;

void main()
{
Convert();
}

void Convert()
{
Entry = new char;
cout << "Enter Text To Convert(Up To 500 Chars): ";
cin.getline(Entry, 500);
len = strlen(Entry);
temp_len = len;
cout<<"\n\n";

for(int d = 0; d < len; d++)
{
Total = 7;
Letter = Entry[d];
Ascii = Letter;
while(Ascii > 0)
{
if((Ascii%2)==0)
{
Binary[Total] = 0;
Ascii = Ascii/2;
Total--;
}
else
{
Binary[Total] = 1;
Ascii = Ascii/2;
Total--;
}
}

for(int e = 0; e < 8; e++)
{
cout << Binary[e];
Special[e][f] = Binary[e];
}
f++;

cout<<"\n\n";

}

cout<<"\n\nThe output Display in Array : \n\n";

for(int l=0;l<8;l++)
{
hold[y]=Special[l][y];

if(hold[y]==Special[l][k++])
{
temp[z]=0;
while(s<len)
{
if(temp[z]==Special[l][h])
{
temp[m++]=0;
h++;
}
else
{
temp[m++]=1;
h++;
}
s++;
z++;
}
}
else
{
temp[z]=1;

while(s<len)
{
if(temp[z]==Special[l][h])
{
temp[m++]=0;
h++;
}
else
{
temp[m++]=1;
h++;
}
s++;
z++;
}

}

result[u] = temp[temp_len--];
u++;

k=0;
s=2;
z=1;
h=2;
m=1;
y=0;
temp_len = len;

}

while(la<8)
{
for(int oop = 0;oop <len;oop++)
{
cout<<Special[la][oop]<<" ";
}
la++;
cout<<"\n\n";
}

cout<<"\n\nThe result for XOR operation is : \n";
for(int t=0;t<8;t++)
{
cout<<result[t];
}

cout<<"\n\n";

delete[] Entry;
}``````

The program compile? Give a error?

Do what you want?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.