### Any Takers?

This code was supposed to read and write to a file the total votes, either Y or N, for each individual district and for the overall total of each vote.
Problem is that its giving me crazy numbers and idk why

#include <iostream>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{

//declare variable and get input

ifstream inFile;
ofstream outFile;

char vote;
char district;
int totalYV;
int totalNV;
int d1TotalY; //do this for all districts
int d2TotalY;
int d3TotalY;
int d1TotalN;
int d2TotalN;
int d3TotalN;

inFile.open("vote.txt");
outFile.open("votersTotal.txt");

inFile >> district >> vote;

while(inFile)
{ inFile >> district >> vote;

// add in overall total for both

if(district=='1')
{if(vote=='Y')
d1TotalY==1;
totalYV = d1TotalY++;

}
else if(vote=='N')
{
d1TotalN==1;
totalNV = d1TotalN++;
}

if(district=='2')
{if(vote=='Y')
d2TotalY==1;
totalYV = d2TotalY++;
}
else if(vote=='N')
{
d2TotalN==1;
totalNV = d2TotalN++;
}
if(district=='3')
{if(vote=='Y')
d3TotalY==1;
totalYV = d3TotalY++;
}
else if(vote=='N')
{
d3TotalN==1;
totalNV = d3TotalN++;
}

totalYV++;
totalNV++;

};

outFile << "District 1 Y votes: " << d1TotalY << endl;
outFile << "District 1 N votes: " << d1TotalN << endl;
outFile << "District 2 Y votes: " << d2TotalY << endl;
outFile << "District 2 N votes: " << d2TotalN << endl;
outFile << "District 3 Y votes: " << d3TotalY << endl;
outFile << "District 3 N votes: " << d3TotalN << endl;
outFile << "Total Y Votes: " << totalYV << endl;
outFile << "Total N Votes: " << totalNV << endl;

inFile.close();
outFile.close();

return 0;
}
What does the input file contain ?
 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879`` ``````#include #include #include using namespace std; int main() { // declare variable and get input ifstream inFile; ofstream outFile; char vote; char district; int totalYV; int totalNV; int d1TotalY; // do this for all districts int d2TotalY; int d3TotalY; int d1TotalN; int d2TotalN; int d3TotalN; inFile.open("vote.txt"); outFile.open("votersTotal.txt"); inFile >> district >> vote; while(inFile) { inFile >> district >> vote; // add in overall total for both if(district == '1') { if(vote == 'Y') d1TotalY == 1; totalYV = d1TotalY++; //note the indentation } else if(vote == 'N') { //note the indentation d1TotalN == 1; totalNV = d1TotalN++; } if(district == '2') { if(vote == 'Y') d2TotalY == 1; totalYV = d2TotalY++; } else if(vote == 'N') { d2TotalN == 1; totalNV = d2TotalN++; } if(district == '3') { if(vote == 'Y') d3TotalY == 1; totalYV = d3TotalY++; } else if(vote == 'N') { d3TotalN == 1; totalNV = d3TotalN++; } totalYV++; totalNV++; }; outFile << "District 1 Y votes: " << d1TotalY << endl; outFile << "District 1 N votes: " << d1TotalN << endl; outFile << "District 2 Y votes: " << d2TotalY << endl; outFile << "District 2 N votes: " << d2TotalN << endl; outFile << "District 3 Y votes: " << d3TotalY << endl; outFile << "District 3 N votes: " << d3TotalN << endl; outFile << "Total Y Votes: " << totalYV << endl; outFile << "Total N Votes: " << totalNV << endl; inFile.close(); outFile.close(); return 0; }``````
 ```|| foo.cpp: In function ‘int main()’: foo.cpp|37 col 14| warning: statement has no effect [-Wunused-value] || d1TotalY == 1; || ~~~~~~~~~^~~~ foo.cpp|41 col 13| warning: statement has no effect [-Wunused-value] || d1TotalN == 1; || ~~~~~~~~~^~~~ foo.cpp|47 col 14| warning: statement has no effect [-Wunused-value] || d2TotalY == 1; || ~~~~~~~~~^~~~ foo.cpp|50 col 13| warning: statement has no effect [-Wunused-value] || d2TotalN == 1; || ~~~~~~~~~^~~~ foo.cpp|55 col 14| warning: statement has no effect [-Wunused-value] || d3TotalY == 1; || ~~~~~~~~~^~~~ foo.cpp|58 col 13| warning: statement has no effect [-Wunused-value] || d3TotalN == 1; || ~~~~~~~~~^~~~```