Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void add_county_election_file(std::vector<string> & countyNameVector, std::vector<int> & countyNCount, vector<int> & countyFCount, std::vector<int> & countyOCount, int & NCount, int & FCount, int & OCount)
- {
- char vote;
- string filename;
- string countyName;
- NCount = 0;
- FCount = 0;
- OCount = 0;
- cout << "Enter the county file to process: ";
- cin >> filename;
- std::ifstream input((filename).c_str());
- if(input.is_open())
- {
- input >> countyName;
- //adds the county name to the vector of names
- countyNameVector.push_back(countyName);
- while(input >> vote)
- {
- if(vote == 'N' || vote == 'n')
- {
- NCount = NCount + 1;
- }
- else if(vote == 'F' || vote == 'f')
- {
- FCount = FCount + 1;
- }
- else
- {
- OCount = OCount + 1;
- }
- }
- //adds the count of party votes for the current file to a vector
- countyNCount.push_back(NCount);
- countyFCount.push_back(FCount);
- countyOCount.push_back(OCount);
- }
- else
- {
- cout << endl;
- cout << "File not found!" << endl;
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment