Code:
while(inFile2 >> name1)
{
inFile2 >> name2;
inFile2 >> numRegion;
inFile2 >> numVotes;
//now find name1 or name2 (whichever you want to use as the comparison)
//now increment the total votes for the candidate by what's in the numVotes variable.
}
if(inFile2.eof())
cout << "entire file read in without problem" << endl;
else
cout << "error reading file somewhere." << endl;
now when the loop ends you will know all result have been read in or if something else terminated the loop. If successful end of file reading then the candidates can be sorted by total votes and a winner declared.
_______________________________
if(namCan == Two.lastName)
{
inFile2>>namCan;
inFile2>>numReg;
inFile2>>numVotes;
{ //I suspect this brace isn't needed, but I haven't actually copied all your code and mathced up each of the brackets
switch(numReg