Hi,
I have 2 arrays of strings. I wanna display only the words that exists in the first array but doesn't in the second one.
For example :-
Str1 = Apple,Banana.
Str2=Apple, Orange.
Banna should be displayed
this is what I have done so far.
I dunno why it's not working correctly ? I know that is simple, but it seems that I have to refresh my memory ( It has been a while since I used C++ !!! ).
Any help would be greatly appreciated.
Thank you.
I have 2 arrays of strings. I wanna display only the words that exists in the first array but doesn't in the second one.
For example :-
Str1 = Apple,Banana.
Str2=Apple, Orange.
Banna should be displayed
this is what I have done so far.
Code:
string str1[10]; string str2[10]; int i=0,j=0,cmp; for (i=0;i<10;++i) { for(j=0;j<10;++j) cmp=str1[i].compare(str2[j]); if(cmp!=0) cout<<str[i]<<" doesnt exist in the second array"; }
Any help would be greatly appreciated.
Thank you.
Comment