Can anyone help me fix this?

Hi there, I'm somewhat new to C++ and need a little help finishing this program..
So what it basically does is generate all possible combinations in a lottery system, which draws 15 numbers out of a 25 numbers range.
I think the way it is, it is only drawing one combination..
I also applied a few filters, but can't tell if they're right or not (such as verifying how many odds and even numbers, and checking them against past results that can be inserted by the user).
I don't know what i'm doing wrong.. can anyone help me?


#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <fstream>
#include <cstdio>

using namespace std;

void input();
void quit();
void displayall();
void search();
void editFile();
void GetNumbers();
  
const int ARRAY_SIZE = 15;           // SIZE of an array.
const int MAX_RANGE = 25;            // The max range between 1 to 25.
  
// Function prototype
void generateNumbers(int[], int);
int findMatches(int[], int[], int);
void displayValues(int[], int[], int);
  
int main()
{
       int lottery[ARRAY_SIZE];            // To hold the lottery's number in randomly. 
       int numMatches;                     // To holf the matching number.
	   int user[ARRAY_SIZE];               // To hold the user's number.

       system ("title Prototype");
       
       int choice;
       cout << "(1)Input last results" << endl;
       cout << "(2)Search database for last results" << endl;
       cout << "(3)Find possible combinations" << endl;
       cout << "(4)Exit Program" << endl;
       cin >> choice;
       
       switch (choice){
       case 1:
            input();
            break;
       case 2:
            search();
            break;
       case 3:
            GetNumbers();
            break;
       case 4:
            quit();
            break;
            
       cin.get();
            

       }
  }
       
void input(int user[], int ARRAY_SIZE)
{
 string array;
 ofstream pastresults("pastresults.txt", ios::app);
 system("cls");
 
       for(int index = 0; index < ARRAY_SIZE; index++)
       {
              cout << "Enter a number " << (index + 1) << ": "; 
              cin >> user[index];
       }
       pastresults << user << endl;     
 pastresults.close(); 
 main();
     }

void displayall()
{
	 int user;
     ifstream pastresults("pastresults.txt");
     string name;
     system ("CLS");
     cout << "Entire database"<< endl;
     cout << user << endl ;
     system ("pause");
     cin.get();
     main();
     
     }
  
     
void generateNumbers(int lottery[], int ARRAY_SIZE)
{
       srand((unsigned int)time(NULL));
	   int conditions; 
	   int a, sum, even, b, odd = 0 ;
       cout << "Possible numbers "
               << "in the range of 1 to 25." << endl;
       for (int index = 1; index < ARRAY_SIZE; index++)
       {
              lottery[index] = 0 + rand() % MAX_RANGE;
              for (a=1; a<=ARRAY_SIZE; a++){
              
	
				
	
								sum+=lottery[a];
								}
								for (b=1; b<=ARRAY_SIZE; b++){
									if ((lottery[b]) % 2== 0){
										even = 0 + 1;
									}
										else {
											odd = 0 + 1;
										}
									
								}
									
    	          
    	         
        }     
       cout << sum << endl;      
       
            
       
	   //Verifying if the average number is between 13 and 14
	   bool num = true;
	   
	   if (((sum/15) >= 13); ((sum/15) <=14)); {
	   	                      num = true;
	   	                      
	   	                      //Odds and even Numbers
	   	                      bool NumEvens = true;
	   	                      bool NumOdds = true;
	   	                      if (even <= 6; even >=9)
								{
									NumEvens = true;
								}
								if (odd <= 6; odd >=9)
								{
									NumOdds = true;
								}	   	                      
	   	                      //Verify if combination match past results
	   	                      
	   	                      bool arraysEqual = false;     // Flag variable.
       						  int count = 0;               // Loop counter.
                              int numMatches = 0;
                              ifstream pastresults("pastresults.txt");
                              string name;
                              system ("CLS");
  
    
							  // Determine whether the elements contain the same data.
       						  while (arraysEqual && count < ARRAY_SIZE)
       						  {
                              if (lottery[count] = user[count])
                              arraysEqual = false;
                              count++;
                              }
                              return numMatches;
                              
                              

       	   	                      
	   	                      // Display numbers that meet criteria
	   	                      if (num) && (arraysEqual) && (NumEvens) && (NumOdds){
	   	                      	cout << lottery;
	   	                      }
              
	      		   	
	   }       
}
Last edited on
Please do not crosspost. It clutters forum, spreads discussion on your problem between two threads and generally annoy people.

Another post: http://www.cplusplus.com/forum/general/142755/
Topic archived. No new replies allowed.