I am trying to make a program that compares the scores of two bowling groups. In bowling1.dat there are 7 scores and in bowling2.dat there are also 7 scores. I want to compare the first score in each one and tell who wins. This is what I have so far in the program:
int main(){
ifstream bowling1;
ifstream bowling2;
int value, scores, max;
bowling1.open("bowling1.dat");
bowling2.open("bowling2.dat");
max = 0;
while (bowling1>>value){
max++;
}
cout<<"How many scores do you want to compare? ("<<max<<" max)";
cin>>scores;
for (int counter = 1; counter <= scores; counter++){
bowling1>>value;
bowling2>>value;
cout<<counter<<" "<<value<<endl;
}
bowling1.close();
bowling2.close();
return (0);
}
____________________________________________________________________________
As of right now, this program only displays the scores of one of the files. That's it. Please help! :)