Sunday, July 12, 2009

Help with c++ program please!?

im supposed to use arrays for this program in the function tally and function print





heres what i have so far


#include%26lt;iostream%26gt;


#include%26lt;fstream%26gt;


using namespace std;


void tally(int votes[12]);


void print(int, int, int votes[12]);





int main() {


int votes [12];


votes[0]=0;


votes[1]=0;


votes[2]=0;


votes[3]=0;


votes[4]=0;


votes[5]=0;


votes[6]=0;


votes[7]=0;


votes[8]=0;


votes[9]=0;


votes[10]=0;


votes[11]=0;





int p1=0,p2=0,vp1=0,vp2=0,s1=0,s2=0,t1=0,t2=...


int vote;








ifstream voter;


voter.open("ballot.txt");














while(!voter.eof()){








voter%26gt;%26gt;vote;





if (vote==1){


p1+=1;}


if (vote==2){


p2+=1;}


if (vote==3){


vp1+=1;}


if (vote==4){


vp2+=1;}


if (vote==5){


s1+=1;}

Help with c++ program please!?
Didnt look through everything, but one problem is call print this way





print(3, 4, votes);


not


print(3, 4, votes[12]);


No comments:

Post a Comment