View Single Post
Old 11-30-2012, 01:11 PM   #2
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: C++ fstream and arrays

I'm not exactly sure what you want to do, but if you're just scanning for guesses you could just make an array of arrays, one that holds each users guesses. You can then make a loop that goes through each element of the larger array (1 for each user) and scan each guess and just have an int counter to count how many are correct. Something like:

Code:
int correctGuesses = 0;
int correctNumbers [7] = {7, 21, 32, 44, 10, 39, 80}
for(int i = 0; i < numUsers; i++)
{
     for(int j = 0; j < 6; j++)
          {
               for(int k = 0; k < 6; k++)
                    {
Here's your 2d arary: if(usersArray[i][j] == correctNumbers[k])
                            correctGuesses++;
                    }
          }
}
Then just save the correct guesses counts for each user into another array to keep track of how many each user got right. Then you can do another loop of sorts to do a payout calculation. You can also dick around with usernames or just remember what order you had them in.

Btw, I probably did a bunch wrong since I suck at C++ as well, but I think this make sense.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote