I am in my first month of programming o be kind. I am taking at .txt and using its data to complete survey. It is adding an extra male and I do not know why.
Would be wise to change this to elseif(gender == 'F')
I have a feeling that's where the issue is coming in at. Basically, if your file does not have an 'M' as the second entry per line, it's going to add one to the female count. What if someone made a mistake and did 'm'? It would add another female
Thank you for your response, I tried you suggestion and still have same result. All my ELSE statement are where my arithmetic is going wrong. All the IF ones are doing what they are supposed to.
Even if it loops through an extra time, it shouldnt add any to the count. Unless it is reading a line twice. Put a cout in each if block and just have it print out whatever it found. You should be able to catch whatever is happening that way