Advertisement
teknique

Untitled

Oct 24th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. #include <fstream>
  5. #include <iostream>
  6. #include <sstream>
  7. using namespace std;
  8. const int NUMOFCANDIDATES = 6;
  9. int main()
  10. {
  11. string filename;
  12. string line;
  13. string party;
  14. string position;
  15. string firstname;
  16. string lastname;
  17. string FRName;
  18. string FAName;
  19. string FCName;
  20. string NRName;
  21. string NAName;
  22. string NCName;
  23. string name;
  24. char firstletter;
  25. char secondletter;
  26. int FCCount = 0;
  27. int FACount = 0;
  28. int FRCount = 0;
  29. int NRCount = 0;
  30. int NCCount = 0;
  31. int NACount = 0;
  32. int OCCount = 0;
  33. int MCCount = 0;
  34. int ORCount = 0;
  35. int OACount = 0;
  36. int TRCount = 0;
  37. int TCCount = 0;
  38. int TACount = 0;
  39. cout << "Please enter the name of the county results file to use: ";
  40. cin >> filename;
  41.  
  42. ifstream inputFile;
  43. inputFile.open("file.txt");
  44.  
  45. while(inputFile.good())
  46. {
  47.  
  48. for (int i=0; i<NUMOFCANDIDATES; i++)
  49. {
  50.  
  51. getline(inputFile, party, ' ');
  52. if(party == "Fieldite")
  53. {
  54. getline(inputFile, position, ' ');
  55. if(position == "Recorder")
  56. {
  57. FRName = name;
  58. }
  59. else if(position == "Auditor")
  60. {
  61. FAName = name;
  62. }
  63. else if(position == "Coroner")
  64. {
  65. FCName = name;
  66. }
  67. }
  68. if(party == "Nullifier")
  69. {
  70. getline(inputFile, position, ' ');
  71. if(position == "Recorder")
  72. {
  73. NRName = name;
  74. }
  75. else if(position == "Auditor")
  76. {
  77. NAName = name;
  78. }
  79. else if(position == "Coroner")
  80. {
  81. NCName = name;
  82. }
  83. }
  84.  
  85. }
  86. }
  87. cout << FRName << endl;
  88. cout << FAName << endl;
  89. cout << FCName << endl;
  90. cout << NRName << endl;
  91. cout << NAName << endl;
  92. cout << NCName << endl;
  93. //else statement to verify that file is valid, if it isn't, it stops the program
  94. return 0;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement