Hello Again Everyone!
I seem to be having an issue where when making a comparison between two values in an array, only the first of said values is recognized.
Data File 1:
CXF341 toyoTA caMRy s
rmj441 NiSSan verSA C
ZmW562 hYundai Tucson S
987abcd ford fiEsta C
Data File 2:
cxf341
987ABCD
rmzddd
rmJ441
Example code:
1 2 3 4 5 6 7
|
for (int r = 0; r < length; ++r)
{
if (yours[r].plate == mine[r].rentPlate)
{
outfile << "rented.\n";
}
}
|
...where 'yours[r].plate' is pulling in the license numbers from Data File 1 via a struct; and 'mine[r].rentPlate' is storing Data File 2.
The output is "rented." printed only once, non-looped.
How do I make the license numbers from each file recognize each other if and only if they are the same?
Sidenote: At this point in the program, I have already run a "transform" function to make all the license's characters capital letters--for both data files. So I would assume that it makes these values more recognizable to each other.
Thanks for any and all help!
Edit: AHA! So whats happening is it is recognizing only values stored in the same place in each array.
This makes since to me since I can see it finds the first values comparable since they are both located at array[0].
So, what should I do in that for loop to make the program recognize same values in other array positions; i.e. array[1] of data file one and array[3] of data file two?