Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <fstream>
- #include <iostream>
- #include <sstream>
- using namespace std;
- const int NUMOFCANDIDATES = 6;
- int main()
- {
- string filename;
- string line;
- string party;
- string position;
- string firstname;
- string lastname;
- string FRName;
- string FAName;
- string FCName;
- string NRName;
- string NAName;
- string NCName;
- string name;
- char firstletter;
- char secondletter;
- int FCCount = 0;
- int FACount = 0;
- int FRCount = 0;
- int NRCount = 0;
- int NCCount = 0;
- int NACount = 0;
- int OCCount = 0;
- int MCCount = 0;
- int ORCount = 0;
- int OACount = 0;
- int TRCount = 0;
- int TCCount = 0;
- int TACount = 0;
- cout << "Please enter the name of the county results file to use: ";
- cin >> filename;
- ifstream inputFile;
- inputFile.open("file.txt");
- while(inputFile.good())
- {
- for (int i=0; i<NUMOFCANDIDATES; i++)
- {
- getline(inputFile, party, ' ');
- if(party == "Fieldite")
- {
- getline(inputFile, position, ' ');
- if(position == "Recorder")
- {
- FRName = name;
- }
- else if(position == "Auditor")
- {
- FAName = name;
- }
- else if(position == "Coroner")
- {
- FCName = name;
- }
- }
- if(party == "Nullifier")
- {
- getline(inputFile, position, ' ');
- if(position == "Recorder")
- {
- NRName = name;
- }
- else if(position == "Auditor")
- {
- NAName = name;
- }
- else if(position == "Coroner")
- {
- NCName = name;
- }
- }
- }
- }
- cout << FRName << endl;
- cout << FAName << endl;
- cout << FCName << endl;
- cout << NRName << endl;
- cout << NAName << endl;
- cout << NCName << endl;
- //else statement to verify that file is valid, if it isn't, it stops the program
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement