for (loop = 0; loop < (seqread - 1); loop++) {
if (name == Datalist[loop].Name) {
difsearch1 = loop;
}
}
Out << difsearch1 << endl;
How come when I try to output "difsearch1" I get a crazy long negative number? Lets say for example that "name == Datalist[3].Name", I want difsearch1 to equal 3 as well. It's probably something simple that I've done wrong but I don't see why that code won't work. "seqread" equals 6 in this case, by the way. Thanks for the help.
You are right... as you can see I used getline() to get name. I got the variable "name" from one input file and Datalist[n].Name stores the exact same name I'm 100% positive but it came from another input file. Could that be the reason that no match was found? I did a simple comparison to see if "name == Data[0].Name" was true and it wasn't. But I know for a fact that location stores the same thing that's in name. I have that name stored in the struct Datalist and all I need is the location of where it's at. All I need is the number inside the brackets of where that name is stored in my struct.