/* Declare two char arrays A and B and input the values in it . Declare another
Array C as int array and fill it in such way that it contains 1 for the index
where values of "A" & "B" are same and 2 otherwise . Output on the screen the
values of all three arrays */
#include<iostream.h>
int main()
{
char a[10];
char b[10];
int c[10] = {0};
cin>>a;
cin>>b;
for (int i=0;a[i] !=0 ;i++)
{
if (a[i]==b[i])
{
c[i]=1;
}
else
{
c[i]=2;
}
}
cout << endl;
for(int h = 0 ; a[h] !=0 ; h++)
{
cout << a[h];
}
cout << endl;
for(int lo = 0 ; c[lo] ; lo++ )
{
cout << c[lo];
}
cout << endl;
for(int l = 0 ; b[l] !=0 ; l++)
{
cout << b[l];
}
return 0;
}
Array C as int array and fill it in such way that it contains 1 for the index
where values of "A" & "B" are same and 2 otherwise . Output on the screen the
values of all three arrays */
#include<iostream.h>
int main()
{
char a[10];
char b[10];
int c[10] = {0};
cin>>a;
cin>>b;
for (int i=0;a[i] !=0 ;i++)
{
if (a[i]==b[i])
{
c[i]=1;
}
else
{
c[i]=2;
}
}
cout << endl;
for(int h = 0 ; a[h] !=0 ; h++)
{
cout << a[h];
}
cout << endl;
for(int lo = 0 ; c[lo] ; lo++ )
{
cout << c[lo];
}
cout << endl;
for(int l = 0 ; b[l] !=0 ; l++)
{
cout << b[l];
}
return 0;
}