Election program

This is a discussion on Election program within the C++ Programming forums, part of the General Programming Boards category; That is probably because some of the braces are wrong place or is just missing!...

  1. #16
    Interested Newbie
    Join Date
    Sep 2004
    That is probably because some of the braces are wrong place or is just missing!

  2. #17
    Registered User
    Join Date
    Mar 2002
    while(inFile2 >> name1)
     inFile2 >> name2;
     inFile2 >> numRegion;
     inFile2 >> numVotes;
     //now find name1 or name2 (whichever you want to use as the comparison) 
     //now increment the total votes for the candidate by what's in the numVotes variable. 
     cout << "entire file read in without problem" << endl;
     cout << "error reading file somewhere." << endl;
    now when the loop ends you will know all result have been read in or if something else terminated the loop. If successful end of file reading then the candidates can be sorted by total votes and a winner declared. 
    if(namCan == Two.lastName)
      { //I suspect this brace isn't needed, but I haven't actually copied all your code and mathced up each of the brackets

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21