At the top to make things a little more smooth:
1 2 3 4
|
#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
|
There is an argument against the
using namespace std;
line, so look that up if you get the chance.... Someone will probably post the link.
If you have variable arrays, and are already using standard libraries, why not use vector?
Beyond that, you could make the third array the double the size of the other two arrays and keep track of what it used. Then you could just dump as you check, so you don't have to traverse the arrays twice.
If you allow the user to put the same name twice in an array, then you need to check that also.
In this part:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
//it checks the two first tables to see what
//is not in common so as to put it to the last table
for( e=0; e<n; e++) {
for(int j=0; j<n; j++) {
if (name2[e] == name1[j]){
den=true;
}
if(den==false){
k=k+1;
name3[k] = name2[e];
}
}
}
|
Once you set den to true, then it'll remain true the entire time, so you won't get anything past the first repeat in loop2... well, if it hits in these loops.
When you hit where
den=true;
you can probably break from that inner loop there.
I think you mean to have the
if ( den == false )
part outside of the first loop. It's hard to tell, since you don't really use brackets much.
Hope that helps for now... If you are allowed to use vector (or other container class), then I suggest it.
..Oh, for the future using
[code]
[/code] tags around your code makes it easier to read.