64 730
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #31597 in C++ for MANMOHAN SHARMA

Question #31597
1. "Write a function to find out common alphabets between two arrays. Length of array is not fixed and may contain other data type also.”
Expert's answer
#include <iostream>
#include <string>
#include<iostream>

using namespace std;
/*"Write a function to find out common alphabets between two arrays. Length of
array is not fixed and may contain other data type also.”
*/
const int n=10;

int main()
{
char ar1[n];
char ar2[n];

char ch;
int i=0;


cout<<"enter 1st array& 0 -to exit\n";
cin>>ch;
while (ch !='0')
{
ar1[i] = ch;
++i;
cin>>ch;
}

cout<<"enter 2nd array\n";
int j=0;
cin>>ch;
while (ch!='0')
{
ar2[j] = ch;
++j;
cin>>ch;
}


char w[n];
int count=0;

for (int k=0;k<i;++k)
{
for (int h=0;h<j;++h)
{
if (ar1[k] == ar2[h])
{
bool ind = true;
for (int y=0;y<count ;++y)
{
if(ar1[k] == w[y]) {ind = false; break;}
}
if (ind == true) w[count++] = ar1[k];
}
}
}

cout<<"Common letters\n";
for (int y=0;y<count ;++y)
cout<<w[y];

cout<<endl;


system ("PAUSE");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions